Created
February 24, 2012 15:54
-
-
Save jasonrdsouza/1901709 to your computer and use it in GitHub Desktop.
Revisions
-
jasonrdsouza created this gist
Feb 24, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ def getchar(): #Returns a single character from standard input import tty, termios, sys fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch while 1: ch = getchar() print 'You pressed', ch