Go to advanced search

by paddyg
Wed Dec 04, 2019 11:54 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 621

Re: lancer un programme avec un interrupteur

You can run Vcc at 3V3 according to the datasheet. aka Vous pouvez exécuter Vcc à 3V3 selon la fiche technique.
by paddyg
Wed Dec 04, 2019 10:48 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 621

Re: lancer un programme avec un interrupteur

DON'T connect your GPIO to 5V. Make the switch connect to ground and set the pin to use an internal pull up. Look at the gpiozero library for how to run processes when a switch is pressed. explicitly: Ne pas appliquer 5V à la GPIO . Faites votre commutateur court à la terre et avoir un pull-up inter...
by paddyg
Fri Nov 29, 2019 12:07 pm
Forum: Python
Topic: Difficulties with first python script (user input yes/no)
Replies: 19
Views: 760

Re: Difficulties with first python script (user input yes/no)

@CatDadJynx, if you are just starting down the road of programming with python then now is the time to stop using python2 and start using python3. In only a few weeks python2 reaches end of life. It won't drop off the end of a cliff and stop working but pretty much all major package developers (and ...
by paddyg
Fri Nov 29, 2019 8:23 am
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 918

Re: Multitasking in Python

@Wangmaster, glad you got it sorted (though that does look quite complicated!) I notice that you are adding the interval for the next task time which will lead to a slight drift over millions of iterations. Adding (count * interval) to the start time won't.
by paddyg
Thu Nov 28, 2019 5:20 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 918

Re: Multitasking in Python

Paul, As well as @thagrol's comment on using threads to run things in functions, which IMHO simplifies things a lot (unless you are doing one basic thing), the trouble with sleeping the way you show is that the time.sleep() function isn't terribly accurate. So, as the OP asked for minimal drift over...
by paddyg
Thu Nov 28, 2019 1:24 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 918

Re: Multitasking in Python

Yes, you are absolutely right in a literal sense but the OP doesn't need the sub micro second accuracy for starting each function but they don't want the cumulative drift which is inevitable if you calculate the next call time by 'simply' adding a fixed amount onto 'now'. To fix the problem using Ti...
by paddyg
Thu Nov 28, 2019 12:31 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 899

Re: OpenGLES and Raspberry PI 3

Val, I'm curious to know what caused those compile errors. Are you using stable as opposed to nightly, and latest version? What do you get with [email protected]:~/rust/rust_pi3d/pi3d $ rustup show Default host: armv7-unknown-linux-gnueabihf rustup home: /home/pi/.rustup stable-armv7-unknown-linux-gnue...
by paddyg
Thu Nov 28, 2019 12:11 pm
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 9429

Re: Pi3D transparent background on Pi4

Yes (and no, it's X11 window related rather than OpenGL). With the compositor running (it's turned off by default in raspbian buster but you can start it with ``xcompmgr``, already on in ubuntu or gentoo64) you can adjust the opacity of the X11 window. See the discussion on the first page of this th...
by paddyg
Thu Nov 28, 2019 8:49 am
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 918

Re: Multitasking in Python

You shouldn't get drift as the run time is set by the internal clock (which is verified against the internet if connected) The timer module probably does something very like my code snippet i.e. puts the timing in a different thread then, to avoid checking the time every execution cycle, sleeps for ...
by paddyg
Wed Nov 27, 2019 8:16 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 899

Re: OpenGLES and Raspberry PI 3

Yes it is a bit odd. Just read your other thread and seen the eglSwapInterval(0) tip. The SDL2 route doesn't use EGL (unless SDL2 does something behind the scenes) but there is an SDL function (also exposed in the rust crate) to set SwapInterval. I tried it on one of the rust_pi3d demos and the fps ...
by paddyg
Wed Nov 27, 2019 6:25 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 899

Re: OpenGLES and Raspberry PI 3

The fakeKMS driver will run GLES code and seems to run GL and GLES2 or GLES3 code at the same speed, and pretty much at the same speed as on the RPi3. See some comparisons I did here . Not sure what language you are interested in. Is that error from running the code on github.com/skillman/raspberryp...
by paddyg
Wed Nov 27, 2019 3:10 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 918

Re: Multitasking in Python

Yes, but the timing of sleep is a bit approximate (see previous threads on this forum). That only matters if timing is important, if it is I sometimes sleep for a bit less than needed, a bit like this: import time import threading def job1(): print("job1 {}".format(time.time())) def timer(params=[1....
by paddyg
Wed Nov 27, 2019 9:46 am
Forum: Python
Topic: Display full screen image using Python?
Replies: 5
Views: 478

Re: Display full screen image using Python?

I can't see a ref to this in that example code, but you can get tk to use fullscreen (rather than maximized which I think the geometry(wxh+0+0) does) using something like import tkinter tk = tkinter.Tk() tk.attributes("-fullscreen", True) and here's some slightly complicated code to fill the screen ...
by paddyg
Sun Nov 24, 2019 12:37 pm
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 9429

Re: Pi3D transparent background on Pi4

The transparent background uses libGLX and an X extension libXrender. Which seems to be already available on raspbian and ubuntu but may be harder to find elsewhere.
by paddyg
Sun Nov 24, 2019 8:14 am
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 9429

Re: Pi3D transparent background on Pi4

Gavinmc42 wrote:
Sun Nov 24, 2019 12:58 am
Does glClearColor(0.0, 0.0, 1.0, 0.0) work on PC's?
Yes, but only using the mechanism discussed at the start of this thread (glx and X extension) I've not got it working with the sdl2 branch or on Windows (can't get the sdl2 window to work at all on Windows yet)
by paddyg
Sat Nov 23, 2019 8:36 am
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 9429

Re: Pi3D transparent background on Pi4

Getting the transparent background looks tricky http://forums.libsdl.org/viewtopic.php?p=44939 is only explicit ref I can find. PS I've tried testing for availability of pysdl2 on init of pi3d and defaulting to that unless explicitly set use_sdl2=False That might be a nicer approach but will see how...
by paddyg
Fri Nov 22, 2019 7:24 pm
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 9429

Re: Pi3D transparent background on Pi4

@Gavinmc42, Just pushed a generally working (on gentoo64) pi3d using sdl2 to https://github.com/tipam/pi3d/tree/sdl2 If you've cloned the repo you can git checkout sdl2 then in the pi3d_demos folder you need to have demo.py pointing to the local pi3d repo and the pi3d.Display.create() needs to have ...
by paddyg
Fri Nov 22, 2019 6:48 pm
Forum: Python
Topic: Having trouble with classes - tkinter - python
Replies: 1
Views: 144

Re: Having trouble with classes - tkinter - python

The benefit of splitting your code up is actually to make these problems explicit so you encapsulate the functions you have 'lying around' as methods belonging to relevant class instances; you might have to do some refactoring... But for your specific issue, you have to pass a reference to the funct...
by paddyg
Wed Nov 20, 2019 10:56 pm
Forum: Python
Topic: Problems installing pygame
Replies: 5
Views: 312

Re: Problems installing pygame

The SDL library is probably installed with the X11 server stuff. You can use pygame without the X11 desktop but (I think) you have to build your own SDL. You might have to install the dependencies, probably xorg and (now I look at it pygame still seems to use SDL as opposed to SDL2 https://packages....
by paddyg
Sun Nov 17, 2019 11:02 pm
Forum: Python
Topic: Problems installing pygame
Replies: 5
Views: 312

Re: Problems installing pygame

You don't want to go down the python 2 route at this stage (only 6 weeks of support!)

Have you tried pip3 install pygame --user or sudo pip3...
by paddyg
Sat Nov 16, 2019 10:31 pm
Forum: Python
Topic: how to filter certain values ​​from a list
Replies: 8
Views: 349

Re: how to filter certain values ​​from a list

Out of curiosity import timeit setup = ''' import random import numpy as np list_1 = ['1' , '2', '2', '2', '3', '4', '5'] list_2 = list_1 * 1000 random.shuffle(list_2) list_1n = np.array(list_1) list_2n = np.array(list_2) ''' fns = [ ''' #### vanilla loop len == 7 ##### 0.37 ms temp = [] for c in li...
by paddyg
Sat Nov 16, 2019 12:17 pm
Forum: Python
Topic: Pause a program in python
Replies: 7
Views: 469

Re: Pause a program in python

Is your code on a repository so we can look at it? With control programs generally I wouldn't use sleep or pause, apart from for a second or two every loop. I would check the time against a trigger time for the next action. That's kind of what the pause module intends to do but it might have lots of...
by paddyg
Sat Nov 16, 2019 8:49 am
Forum: Graphics programming
Topic: Open GL 2.1 on RPi 4
Replies: 8
Views: 1277

Re: Open GL 2.1 on RPi 4

Quite a few things without code or errors to look at. You might glean something by looking at pi3d shaders and the Shader class which does some parsing (near end of file) Between GL21 and GLES20 I think the only difference was #version and //precision GLES30 had in and out types to sub for varying a...
by paddyg
Thu Nov 14, 2019 10:22 am
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 226
Views: 40806

Re: Image viewer with transition between images

Glad you sorted it.. let me know if anything is broken (hopefully not) Another thing about pip that I've found is that it sometimes gets in a tangle with sudo. The problem is that things get installed for root and then there are subsequent permission issues. The best way (that I have found) is to us...

Go to advanced search