Created
August 17, 2012 23:09
-
-
Save KitWallace/3383365 to your computer and use it in GitHub Desktop.
Read the Labtec Presenter keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import tty | |
def read_key() : | |
tty.setcbreak(sys.stdin) | |
last = 0 | |
while True : | |
code = ord(sys.stdin.read(1)) | |
if (code== 53 and last==91) : | |
key = "left" | |
elif (code==98) : | |
key = "down" | |
elif (code==54) : | |
key = "right" | |
elif (code==49) : | |
key = "up" | |
else : | |
key = None | |
last=code | |
if not(key is None) : | |
yield key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment