I've not done it but I'm pretty sure it can. You might be able to just import the packages as usual, at worst you may have to dress it up a little. Here's a project using GPIO with cython It's probably worth splitting the jobs into different threads or using some of the callback systems if those are...
Same thing but using mpg321 to modify shader in real time. Struggling on this video with X eating all the cpu but fine without (like this). @lecloneur is promising lots of new filters!
Once you've got the profile data (I know you were digging into this) you could hive off the offending code into functions that you can compile with Cython . I've used this on the raspberry pi and it's remarkably easy to do (certainly compared with writing you own module in C). The biggest benefit co...
Well writing a game is **hard**, typically it will take a team of experienced programmers and graphic artists thousands of hours and they will utilise vast amounts of pre-written material. For a good 3D game the majority of the programmers will have a good grasp of trigonometry, vectors and matrices...
Any reasonable feature request considered. If submitted on paper in triplicate and duly endorsed by five stalwart citizens (ideally senators but senior partners of sufficiently large firms of attorneys may do)
We've recently changed things a bit (a lot relative to that last link) The demos are all in a different place from the raw package now. I would suggest looking here , to see about downloading and installing. Unless you want to hack the pi3d source I would suggest using one of the first two 'install'...
Dave, I really don't know but here's a handy way of getting python to do 'anything' you can do in a terminal! import os, subprocess def _run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return iter(p.stdout.readline, b'') os.chdir("/proc") files =...
If you want your python program to do other things while it's watching out for a key press then it's surprisingly non-trivial. The easiest way is probably to use curses though there are various annoying things that go along with it import curses stdscr = curses.initscr() stdscr.nodelay(1) # doesn't ...
Finally pushed into doing something about rendering to texture for post processing like this temp.jpg http://youtu.be/yBMjVzKgPZU PS if you want the code for this from github I have put the demos in a different place. And you need to get these latest things from the develop branches in github.com/ti...
Hi, just tried this and it works ok, so my comments are not now pure guesswork! I did basically as I said in my last comment i.e. change the 'python setup.py install' to 'python3 setup.py install' this puts the pyaudio files into /usr/local/lib/python3.2/dist-packages/ which is where python3 looks f...
How did you install pyaudio? Was it following the procedure here (debian) which seems to only have distributions for x86 machines or with 'sudo apt-get install python-pyaudio'? There look to be python2 and python3 packages, does your app work ok with python2? You might have to do something as outlin...
don't hack it, use platform as @davef says. It's platform independent python.
in pi3d we decided it was actually more relevant to know what shared libraries were available rather than the actual machine or operating system. We do this with ctypes.util.find_library() which seems to work well.
@robbes, those look like really useful tools. On the issue of memory leak tracking I found this code to be really helpful and quite simple to wrap round potentially leaky code:
Yes, I noticed I had written python3 after I posted. I just copied and pasted from a post on the pi3d google groups where I was talking about trying to track down why python3 seemed to do one particular thing (reading from /dev/input/) badly c.f. python2. Obviously for that particular exercise it wa...
It's not too hard to do profiling in python. What I have done is run the program like this python3 -m cProfile myapp.py > temp3_01.txt then paste the results into a spreadsheet to sort by number of calls or total time etc. If you run the program for the same length of time each time you do it you ca...
yes, that's right. If timing was critical then you would have to utilise a different thread. In python that's not the end of the world (in terms of complexity) but better to work up to that if you find you need to.
you could use something like while true: tmnow = time.time() if on_time > 0 and tmnow > (on_time + 0.1): # use a variable duration really GPIO.output(12, GPIO.LOW) on_time = -1 # something switches the light on, could be a timer as for switching it off if switch_on(): GPIO.output(12, GPIO.HIGH) on_t...
Presumably you want to be able to press a key and something happen, and not have the program stop waiting for a key input, and not have to press the enter key afterwards as well. This is a surprisingly difficult and commonly required thing for python to do. In pi3d we either use curses or low level ...
hmm, that doesn't look entirely logical to me if the package is imported 'as gpio'
I did something with GPIO following the example here and it seemed to work. The callback function is passed as a keyword argument in GPIO.add_event_detect and GPIO.add_event_callback isn't used
Tom, brilliant. That's solved it. But ironically I also find I can undo the two changes that I thought were making the difference!! i.e. inserting at 0 and deleting the top __init__ and it still works. The critical thing was in your comments about looking for textures, models etc. I created /home/an...