Hey fellow python lovers,
I have been working on some applications for some research studies I am running and thougth I’d share some code. I was having trouble with the OSC lib in touchpy a while back (although I think the newer version work great) so I used
simpleOSC to get a thread reading TUIO messages. I used some of the code form touchpy as well and have written some classes for use with pyglet. This should run on Windows/OSX/linux. I have tested it mainly on Ubuntu and more breifly on windows XP and OSX.
The idea here is to let pyglet get multi touch events just like it gets all its other events. I have written a custom event loop for use with pyglet and a TouchWindow class that receives dispatched multitouch events just like it receives other events. So you can attach your event handler for multi touch just like you attach mouse/window event handlers (also allows multiple event handelers and dynamically attaching/detaching event handlers). Also the mouse events will trigger touch events with touchID “mouse”...its not as full featured as a TUIO simulator yet, but it makes testing a little easier.
Check out the example apps, most of them are < 100 lines of code, so they should give you a quickidea of how to use the classes.
touchtracer.py
just draws an image and a line to trace each touch
glPaint.py
very simple drawing app with a oversimnplified colorpicker (notice that you can change color while drawing)
untabgle.py
a simple game that draws a circular graph and places the vertices at random locations. goal of the game is to untangle the graph (similar to http://www.planarity.net)
3dmt.py
draws an obj model exported form blender and lets you rotate it around, the more fingers you use the faster it rotates
Edit: Here are some quick snapshots of untangle.py and 3dmt.py:
Any feedback, testing or suggestion welcome
