Skip to content

A simplified ctypes binding for the leap motion controller.

Notifications You must be signed in to change notification settings

kne/python-leap-ctypes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ctypes binding for leap motion

This is a simple ctypes binding for the leap motion, because the existing SWIG based on is so hard to use.

Specifically, linking dynamically to the python framework on OSX means that you can't use pyinstaller with leap code.

Which sucks.

So what is this? It's a new library with a C binding (libcleap) and a ctypes binding for that.

Quick start

c = leap_controller()
l = leap_listener(500)
leap_add_listener(c, l)

try:
  while True:
    event = leap_poll_listener(l)
    if event:
      if any(e.frame.hands):
        print(e.frame.hands[0])
except: 
  pass

leap_remove_listener(c, l)
leap_listener_dispose(l)
leap_controller_dispose(c)

See tests/test.py for a complete example.

Compiling libcleap

Use cmake.

mkdir cleap/build
cd cleap/build
cmake ..
make

For windows you may want to use cmake-gui to generate a build file.

Notice that because the original leap DLL is built with visual studio you must build libcleap with visual studio or visual studio express (free) too.

About

A simplified ctypes binding for the leap motion controller.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 35.2%
  • Objective-C 27.0%
  • Python 24.3%
  • Objective-C++ 12.7%
  • Other 0.8%