PyKinect (Yep, Python and Kinect, in Visual Studio yet!)


Credit for today's entry goes to Develop with Python in Visual Studio, connect with Kinect and Excel. I don't follow Python news much and so might have missing this if it wasn't for Dan's post.

Not only do does this highlight the latest version of the Python Tools for Visual Studio release, but shows off using Python to develop Kinect for Windows SDK games and applications. 

PyKinect – write Kinect games using Python!

We are very excited to announce PyKinect with PTVS [Python Tools for Visual Studio] 1.1. PyKinect enables writing awesome games and interfaces using Python:



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:


Project Information URL:

Project Download URL:

Project Source URL:




if __name__ == '__main__':
    full_screen = False
    draw_skeleton = True
    video_display = False

    screen_lock = thread.allocate()

    screen = pygame.display.set_mode(DEPTH_WINSIZE,0,16)    
    pygame.display.set_caption('Python Kinect Demo')
    skeletons = None

    kinect = nui.Runtime()
    kinect.skeleton_engine.enabled = True
    def post_frame(frame):
  , skeletons = frame.SkeletonData))
            # event queue full

    kinect.skeleton_frame_ready += post_frame
    kinect.depth_frame_ready += depth_frame_ready    
    kinect.video_frame_ready += video_frame_ready    , 2, nui.ImageResolution.Resolution640x480, nui.ImageType.Color), 2, nui.ImageResolution.Resolution320x240, nui.ImageType.Depth)

    print('Controls: ')
    print('     d - Switch to depth view')
    print('     v - Switch to video view')
    print('     s - Toggle displaing of the skeleton')
    print('     u - Increase elevation angle')
    print('     j - Decrease elevation angle')

    # main game loop
    done = False

    while not done:
        e = pygame.event.wait()
        dispInfo = pygame.display.Info()
        if e.type == pygame.QUIT:
            done = True
        elif e.type == KINECTEVENT:
            skeletons = e.skeletons
            if draw_skeleton:
        elif e.type == KEYDOWN:
            if e.key == K_ESCAPE:
                done = True
            elif e.key == K_d:
                with screen_lock:
                    screen = pygame.display.set_mode(DEPTH_WINSIZE,0,16)
                    video_display = False
            elif e.key == K_v:
                with screen_lock:
                    screen = pygame.display.set_mode(VIDEO_WINSIZE,0,32)    
                    video_display = True
            elif e.key == K_s:
                draw_skeleton = not draw_skeleton
            elif e.key == K_u:
       = + 2
            elif e.key == K_j:
       = - 2
            elif e.key == K_x:
       = 2