try: import msvcrt def getkey(): """Wait for a keypress and return a single character string.""" return msvcrt.getch() except ImportError: import sys import tty import .