diff options
author | Julian Teu <julianteule@gmail.com> | 2018-04-10 18:07:28 +0200 |
---|---|---|
committer | Julian Teu <julianteule@gmail.com> | 2018-04-10 18:07:28 +0200 |
commit | 3e00fc23117a6fbb91d5ca09602f8006c3f2365a (patch) | |
tree | 4e3f2288424a5c09e9815eff04719f620cd7b321 /Scripts/getch.py | |
parent | a3443fca6351cbe9ecbbe29a32e358f7534a92a6 (diff) |
Cleanup
Diffstat (limited to 'Scripts/getch.py')
-rwxr-xr-x | Scripts/getch.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/Scripts/getch.py b/Scripts/getch.py deleted file mode 100755 index be6203f..0000000 --- a/Scripts/getch.py +++ /dev/null @@ -1,38 +0,0 @@ -class _Getch: - """Gets a single character from standard input. Does not echo to the -screen.""" - def __init__(self): - try: - self.impl = _GetchWindows() - except ImportError: - self.impl = _GetchUnix() - - def __call__(self): return self.impl() - - -class _GetchUnix: - def __init__(self): - import tty, sys - - def __call__(self): - import sys, tty, termios - 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 - - -class _GetchWindows: - def __init__(self): - import msvcrt - - def __call__(self): - import msvcrt - return msvcrt.getch() - - -getch = _Getch() |