Go to advanced search

by paddyg
Fri Jun 05, 2020 3:27 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Beat, Allowing web access to change things is very easy to do in python (almost just a line or two of code (plus HTML and javascript if you want it to look nice)) and it obviously doesn't need any kind of performance... but there would be security issues if you wanted to access it from outside the l...
by paddyg
Fri Jun 05, 2020 2:32 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Hi, With the slide image loading I check if the variable a (for alpha but it's actually a uniform parameter passed to the shader) is less than 1 https://github.com/pi3d/pi3d_demos/blob/master/PictureFrame.py#L332 and prevent any file loading while the transition is taking place. If you do the image ...
by paddyg
Wed Jun 03, 2020 10:14 am
Forum: Python
Topic: raspberry pi and python internet radio code
Replies: 2
Views: 136

Re: raspberry pi and python internet radio code

Maybe the first os.system() command interferes in some way. What happens if you press next *before* on. I've found that the curses module can stop prints arriving on the terminal. If I need to debug something (though it sounds like your radio is working fine, and presumably you will run this headles...
by paddyg
Sat May 23, 2020 7:11 am
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

OK. There are three ways to achieve that (probably more). 1 blend mode where you would draw the text and mask before the main image and probably not get nice edges. 2 stencil mask 3 tweak the shader. The latter two are further into the workings of OpenGL than most of pi3d but not so tricky. I will p...
by paddyg
Fri May 22, 2020 5:06 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Hi, If you implemented your earlier idea of using a png file with the text on it then you can make a rectangular mask effect by changing the UV values on the plane you use to display the text. Here is a cut-down version to give you an indication what to do. import pi3d SCALE_FACTOR = 2.0 # this will...
by paddyg
Sat May 16, 2020 6:29 pm
Forum: Python
Topic: subprocess and if statements, how to kill a process with blynk
Replies: 5
Views: 277

Re: subprocess and if statements, how to kill a process with blynk

Using global variables like that is a bit horrible. Python globals are especially tricky as the interpreter follows a system (that you should look up) to determine the scope of tokens it comes across in functions to decide what to do. For instance, if you defined eca as a class you wouldn't need to ...
by paddyg
Sat May 16, 2020 1:08 pm
Forum: Python
Topic: subprocess and if statements, how to kill a process with blynk
Replies: 5
Views: 277

Re: subprocess and if statements, how to kill a process with blynk

Well without getting bogged down in blynk or trying to get ecasound working, this simple test works for me. import subprocess import time def my_write_handler(value): global eca print("Current V1 value: {}".format(value)) if int(value[0]) == 1 and eca is None: #or have some code to avoid starting mu...
by paddyg
Tue May 12, 2020 5:30 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Well in many ways blending an image file is easier. You need to apply it as a texture to a Plane (with the same dimensions as the image), set the z location in front of the slide, use the uv_flat shader, set Texture.blend = True and draw() after drawing slide. Approximately like ... libre = pi3d.Tex...
by paddyg
Tue May 12, 2020 1:52 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Hi, this seems to work OK with text fading identical to PointText system ... sbg = None # slide for foreground if nFi == 0: print('No files selected!') exit() ###################################################### # FixedString. If SHOW_NAMES is False then this is just used for no images message tex...
by paddyg
Tue May 12, 2020 12:43 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Hi, yes, carriage returns in the TextBlock/PointText system is still on the TODO list. The advantage of the TextBlock is that the characters can be moved around and changed very easily with little CPU load. Basically each character is an OpenGL point textured from a location on grid of characters- t...
by paddyg
Wed May 06, 2020 10:10 pm
Forum: Python
Topic: Help with controlling digital pot over SPI using spidev
Replies: 1
Views: 127

Re: Help with controlling digital pot over SPI using spidev

your hex() will surely turn the int value into a string representing the number in hexadecimal. i.e.
>>> hex(64)
'0x40'
>>> type(hex(64))
<class 'str'>
>>>
but you should be able to pass a list of int values to xfer()
by paddyg
Wed May 06, 2020 10:01 pm
Forum: Python
Topic: subprocess and if statements, how to kill a process with blynk
Replies: 5
Views: 277

Re: subprocess and if statements, how to kill a process with blynk

I don't know what wrapping the @blynk.VIRTUAL_WRITE decorator round your function does but the function you define will create a temporary variable 'eca' just for the duration of it running. When the elif branch runs it must be a different instance of the function being executed and there will be no...
by paddyg
Wed Apr 29, 2020 11:22 am
Forum: Python
Topic: Read data as bytes using GPIO input
Replies: 1
Views: 101

Re: Read data as bytes using GPIO input

I'm sure it is possible. In the code you posted it's not clear where the variable `i` appears from. Also your latching system with the two internal while loops looks complicated. I think you would be better off using the gpiozero module and, whether you use gpiozero or stick with RPi, trigger a func...
by paddyg
Tue Apr 21, 2020 8:12 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Sven, that sounds good. Rather than try to do any major re-engineering inside pi3d to cope with two Display instances, it's probably easiest to a) make the transition time long so the change in alpha with each frame is very small b) ensure that only one PictureFrame.py is transitioning at once with ...
by paddyg
Mon Apr 20, 2020 5:35 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Sven, from James' comment it sounds like there might be issues with that. At some stage I will get a second screen set up and do some experiments... Meanwhile have you managed to get two instances of the PictureFrame app running at the same time? Does it run OK? There might be problems with memory i...
by paddyg
Mon Apr 20, 2020 1:45 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Maybe. I'm out now (exercise ration) but will explain when back. OK back now. What I can do on my ubuntu laptop - which sounds like it's the way rasbian might be set up - is to start a second instance of pi3d running, and in that one move the display off to one side. If I make the x position equal t...
by paddyg
Sun Apr 19, 2020 9:09 am
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Sven, OK, I had quick look on my RPi4 this morning. The only way I can get any OpenGL output is if I set the driver (using raspi-config/advanced/GLdriver) to Fake KMS. I checked that does indeed toggle the existence of the vc4 line in /proc/modules. So for pi3d to work on RPi4, PLATFORM has to be PL...
by paddyg
Sat Apr 18, 2020 10:47 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Sven, thanks for having a look at this for me. I'm not sure what you mean by "running any pi3d templates..." have you managed to run any of the pi3d_demos scripts OK before trying to get both screens working? I will have a look on my RPi in the morning and see what's happening. The platform is set i...
by paddyg
Tue Apr 14, 2020 6:39 pm
Forum: Python
Topic: Matplotlib Run Problem
Replies: 5
Views: 258

Re: Matplotlib Run Problem

As you will have found googling that, some people got that error because of using sudo with pip3 install or related permission type things. Over the past few years I've run into problems and now completely avoid using `sudo pip3` though it's still recommended lots of places! How did you install matp...
by paddyg
Tue Apr 14, 2020 9:07 am
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 265
Views: 46006

Re: Image viewer with transition between images

Chris, glad that your problem seems to be sorted. But it is rather strange! The font being used for displaying with pi3d shouldn't make any difference: In python strings are created by putting characters between quotation marks where the opening and closing quotes are the same. The options are limit...
by paddyg
Mon Apr 13, 2020 1:09 pm
Forum: Python
Topic: pygame or pySDL2 or etc... gui video play
Replies: 2
Views: 158

Re: pygame or pySDL2 or etc... gui video play

There are probably lots of simpler and more flexible ways but you could use popcornmix's hello_video_simple which allows setting position and size and is a very stripped down player. It doesn't need to have the X11 server running so that's a real advantage with the Pi zero. Or you could modify the /...
by paddyg
Sun Apr 12, 2020 1:04 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

OK I've proved to myself that this will require the help of someone else with two displays attached to their RPi. (I can't even get one to work properly, I have to take my HDMI through an HDMI to VGA adapter. Probably because I am using an ancient display). This is what I would do if I had two worki...
by paddyg
Sat Apr 11, 2020 10:00 pm
Forum: Graphics programming
Topic: PI3D - specify the HDMI port to use
Replies: 14
Views: 805

Re: PI3D - specify the HDMI port to use

Hi, it's not obvious! I will play around with this tomorrow and see if I can figure it out. (It will need to have the option added to the arguments of Display.create() as you say.)

Paddy
by paddyg
Sat Apr 04, 2020 3:49 pm
Forum: Python
Topic: Speed up image acquisition
Replies: 5
Views: 227

Re: Speed up image acquisition

Yes the frame rate makes a very big difference - Why do you need to set it to 1? I also don't have a v2 camera but numpy writing code takes 7s at 10fps and 30s at 1fps (I can only go up to 2592, 1944 so it would be bit longer for the slightly bigger frames). Gordon's system probably ends up doing so...
by paddyg
Sat Apr 04, 2020 10:02 am
Forum: Python
Topic: starting and stopping thread in other class
Replies: 12
Views: 407

Re: starting and stopping thread in other class

Hi, it does look quite complicated but I would have thought the time for python to determine those if/elifs were False then find that program_sequence is 31 and counterWheel is greater than x is pretty small. You could improve it a bit by putting the test first rather than seventh and have a precalc...

Go to advanced search