Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2015 10:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
jaraco.input sample
# after ~/opt/venvpy2/bin/pip install jaraco.input
import jaraco.input
import sys
import os
from pyglet import event
class MyJoy(jaraco.input.Joystick):
def __init__(self, device):
event.EventDispatcher.__init__(self) = open(device)
self.ignoreFirst = True
def on_axis(self, axis, value):
#print("axis: %d" % axis)
def on_button(self, button, pressed):
if pressed:
if self.ignoreFirst:
self.ignoreFirst = False
if button == 2:
os.system("xdotool key F8")
elif button == 3:
os.system("xdotool key F7")
joy = MyJoy("/dev/input/js0")
while True:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment