PyKinect – write Kinect games using Python!

 API Reference

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 (

- Kinect SDK (  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



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: .


A request!

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.



Last edited Aug 16, 2012 at 8:14 PM by huguesv, version 13


Teketel Jun 1, 2013 at 11:15 AM 
Great job. while i was trying to setup py kinect and run any of the demo files i get the following error:

Traceback (most recent call last):
File "C:\Users\Jonathan\Downloads\Compressed\KinectDemos\", line 30, in <module>
with nui.Runtime() as kinect:
File "C:\Python27\lib\site-packages\pykinect-1.0-py2.7.egg\pykinect\nui\", line 107, in __init__
self._nui = _NuiCreateSensorByIndex(index)
File "C:\Python27\lib\site-packages\pykinect-1.0-py2.7.egg\pykinect\nui\", line 237, in _NuiCreateSensorByIndex
__NuiCreateSensorByIndex(index, ctypes.byref(inst))
File "_ctypes/callproc.c", line 936, in GetResult
WindowsError: [Error -2097085051] Windows Error 0x83010585

What do you advice? Thanks.

huguesv Aug 20, 2012 at 10:36 PM 
I have created a work item to add support for the new features introduced in the 1.5 SDK. Note that PyKinect currently works with the 1.5 SDK, it just doesn't have the new features.
You can vote for it to show your interest.

amodal1 Jun 24, 2012 at 3:29 AM 
Fancy seeing you here, djtomservo. I'll repeat your question for a more specific case. Has this been updated for the 1.5 version of the SDK?

djTomServo May 23, 2012 at 11:31 PM 
Cool stuff, can we expect regular updates to this to keep pace with the main SDK releases?

TheApe Feb 13, 2012 at 8:48 PM 
The code in the examples and in the pykinect module seems to be broken. The example worked after changing two lines:

1) in
every "frame.image.contents.bits" -> "frame.image.bits"

2) and in the pykinect\nui\
line 114: return desc.height.value -> return desc.height

after this the demo should definitely start