Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. def getch():
  2. fd = sys.stdin.fileno()
  3. old_settings = termios.tcgetattr(fd)
  4. try:
  5. tty.setraw(fd)
  6. ch = sys.stdin.read(1)
  7. except KeyboardInterrupt:
  8. raise
  9. finally:
  10. termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
  11. return ch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement