import termios, tty, sys, select

def getKey():
    settings = termios.tcgetattr(sys.stdin)
    try:
        tty.setraw(sys.stdin.fileno())
        select.select([sys.stdin], [], [], 0)
        key = sys.stdin.read(1)
        return key
    finally:
        termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings)

Wiki: StuartGlaser (last edited 2010-08-19 22:53:33 by StuartGlaser)