Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getch():
- fd = sys.stdin.fileno()
- old_settings = termios.tcgetattr(fd)
- try:
- tty.setraw(fd)
- ch = sys.stdin.read(1)
- except KeyboardInterrupt:
- raise
- finally:
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
- return ch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement