
latest 1.1.864 | nixie project | matrix
The Keyboard Service allows keyboard input to be sent to other services. At the moment the keyboard events are retrieved from a gui element, so the keyboard control must have focus.
Important update:
From version 1.0.1802 the Keyboard service will listen to all keyboard events even if it doesn't have focus.
This small program shows how to get keyboard input into a Python service.
# create services python = runtime.start("python", "Python") keyboard = runtime.start("keyboard", "Keyboard") python.subscribe("keyboard", "publishMouseMoved") # non blocking event example keyboard.addKeyListener(python); def onKey(key): print ("you pressed ", key) def onMouseMoved(mouseEvent): print ("x ", mouseEvent.pos.x, " y ", mouseEvent.pos.y) # blocking example print "here waiting" keypress = keyboard.readKey() print "finally you pressed", keypress, "!"
Wait for enter from a keyboard
Here is what I went with for
Here is what I went with for my servo calibration script.