So you want to use a control pad to send an army of laser-toting death machines into battle? We’ve got you covered.
As long as they’re plugged into an Apple Mac via USB.
⚠️ Please note, PyHID has not been updated since 2011. It’s probably not compatible with modern versions of macOS.
PyHID is a Python module (and C++ library) to communicate with USB Human Interface Devices on Mac OS X. You can use it for a variety of IO tasks; if you have a USB device, and it speaks the USB HID protocol, you should be able to talk to it with PyHID.
PyHID:
Provides a C++ interface that’s simpler than the Mac OS X Carbon libraries
Exports that to Python in a simple, procedural interface
Wraps that in Python classes that offer convenience and style :)
Supports both reading values on demand, and polling them from event queues
Also includes optional extras for specific tasks, including a k8055 module which shows how PyHID can be used to read values from, or control the outputs on, the popular experiment board
Robot army not included
You can read the full documentation online or in the download archive. There are two files over there in the sidebar, one contains the source distribution for you to compile yourself, or for C++ use. The other contains a built distribution, ready to import into your Python 2.5 programs on Mac OS 10.3 or above; simply unpack and place the PyHID folder in your site-packages folder.
PyHID is free to use and generously licensed. If PyHID becomes a key part of your plans for world-domination, please let us know, drop us a link, or give us a friendly mention on your blog. Thanks!