Archive for the ‘Software’ Category
Its time for a new tutorial! This time we will build a slightly(but only slightly) more realistic example. We will use PyGame to render a green box, and allow us to drag it around, and resize it by pinching and squeezing. As usual, if you have any suggestions regarding tutorials, or if you have an idea for a tutorial I should write, send me an email(can be found in the contact me section to the right), or say something in the comments.
Lately I have been working on a Multi-Touch Physics application. It is pretty much a big 2D physics sandbox, you can spawn new objects, make joints, then throw them at stuff. Its written in Python, using Box2D for the Physics engine. TouchPy is used for TUIO Parsing, and PyGame for graphical output.
It does support a ZUI, but it is not a “full ZUI”. It does have simulation limits, so if an object happens to leave this limit it will freeze(as seen in video below). It also does not implement the Gear Joint, but all the other joints are supported.
Its still in early development, so it has its share of bugs. The biggest has to do with triangles. When you choose to make an arbitrary polygon, it works fine with any number of vertices between 4 and 8, but once you try 3 weird things happen. Half of the time it will work, and the other half it won’t. Due to the way PyBox2D was coded, I can’t catch this error either(or any Box2D error, for that matter), so the program will unceremoniously exit.
Code can be had from the downloads page, and here is a video!
Its been a few weeks since I wrote a tutorial(or posted on this blog, for that matter), so I figured it was about time. In this tutorial we will be starting from scratch, and using a different method to get touches. At the end of this tutorial you will have used PyGame to write a program that will draw circles under each touch, and follow them as they move. Most importantly, you will understand how to do it yourself!
This is the second part in an endless series of tutorials dealing with Multi-Touch Development in Python. If you have not read the first one yet, it can be found here.
In the last tutorial we made a really useless example, where every time each TUIO event happened, it would print out “Something left the table”, “Something moved on the table”, or “Something was placed on the table”. We are going to further extend this program to print out where it happened.
I have noticed a lot of tutorials dealing with Multi-Touch in C++, C#, or AS3. There seems be a lack of Python tutorials, but there is a growing number of people wanting to use Python for Multi-Touch apps. I intend to change that with a set of tutorials to teach people how to write Multi-Touch Apps in Python, starting with setting up the environment, all the way to writing a PhotoApp clone with Python-Lux(which is not released yet, and i’m not going to tell you when it will be released in any of these guides. If thats all you came for, sorry I disappointed you).
These tutorials assume basic knowledge of Python, and at times may use some obscure feature of the Standard Library. If you have any questions regarding something you don’t understand, or anything else about Python Development and such, feel free to email me at xelapond @ gmail . com, or PM me on nuigroup(username xelapond). I also usually hang around IRC, #nuigroup, username xelapond. I am happy to assist you with any problems you are having, and I would love feedback on how well this tutorial goes.
I noticed some people were disappointed with the poor speed my last video depicted, so I made a new one. This is take with my Canon digital camera, so there isn’t any Desktop Recording overhead. This demo is with 30 and 100 items, respectively.