PyKinect – write Kinect games using Python!
We are very excited to announce PyKinect with PTVS 1.1. PyKinect enables writing awesome games and interfaces using Python:
Dino goes on a diet: Before (grey) and After (yellow)
Set breakpoints & Explore Kinect sensor data in the debugger directly
- CPython 2.7
- PyGame (http://www.pygame.org/download.shtml)
- Kinect SDK (http://kinectforwindows.org/ 32-bit only!)
- Speech support (Kinect for Windows Runtime Language Pack, version 0.9)
- A kinect sensor (note you don’t need an Xbox 360 to use PyKinect)
- A kinect Power/USB Adaptor (eg:
Sample from Amazon.com)
Assuming you’ve already installed PTVS & a
CPython interpreter, install PyGame, Kinect SDK and PyKinect (order doesn’t matter). To verify the installation, you can check: Tools/Python Tools/Samples/PyKinect -- you should be able use this to install PyKinect into a
32-bit Python distribution:
Note: PyKinect only works with a 32-bit CPython setup currently
Run the demos:
File/New project/… /Kinect Game - this is the “hello world!” of Kinect. This basically sets up the event loop & does basic skeleton tracking:
Pykinect & Pygame make writing Kinect games easy
For a slightly more involved sample, please see:
This sample renders the skeletons w the video or depth cameras. When you run this sample, it opens a console window & prints the available keyboard commands.
Notes about PyKinect:
PyKinect itself doesn’t depend on Pygame – you can write games w/o it. However, our samples do. We use it because Pygame is awesome & popular.
A couple of things to watch out for:
- Currently only 32-bit flavor of CPython is supported (ie, don’t install it w a 64-bit Python interpreter even if PTVS allows it)
- If you are not getting skeleton tracking: make sure your body is within the sensor’s range & your legs are visible to the camera.
- Sometimes the Pygame event queue can be overfilled – if this happens an exception is raised and can be handles appropriately.
Cool things you do with Kinect:
Check out the Xbox Kinect page:
If you develop a game or a sample that you’re willing to share, please let us know! We’d love to see what you’ve come up with & we can feature it here.