summaryrefslogtreecommitdiffstats
path: root/scripts/getch.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/getch.py')
-rw-r--r--scripts/getch.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/scripts/getch.py b/scripts/getch.py
deleted file mode 100644
index 89e13078..00000000
--- a/scripts/getch.py
+++ /dev/null
@@ -1,37 +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()