You can use the vizcedrus module. To connect to the pad use the following:
Code:
#Connect to cedrus pad
import vizcedrus
vizcedrus.open() #Default: port=1 , baudRate=19200
Then you can register callback functions for button events:
Code:
#Setup cedrus callbacks
def cedrusButtonDown(e):
print e.button,'button down'
def cedrusButtonUp(e):
e.button,'button up'
viz.callback(vizcedrus.BUTTONDOWN_EVENT,cedrusButtonDown)
viz.callback(vizcedrus.BUTTONUP_EVENT,cedrusButtonUp)