abc-master
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
getch.py
Go to the documentation of this file.
1
2
class
_Getch
:
3
"""Gets a single character from standard input. Does not echo to the screen."""
4
def
__init__
(self):
5
try
:
6
self.
impl
=
_GetchWindows
()
7
except
ImportError:
8
self.
impl
=
_GetchUnix
()
9
10
def
__call__
(self):
return
self.
impl
()
11
12
13
class
_GetchUnix
:
14
def
__init__
(self):
15
import
tty, sys
16
17
def
__call__
(self):
18
import
sys, tty, termios
19
fd = sys.stdin.fileno()
20
old_settings = termios.tcgetattr(fd)
21
try
:
22
tty.setraw(sys.stdin.fileno())
23
ch = sys.stdin.read(1)
24
finally
:
25
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
26
return
ch
27
28
29
class
_GetchWindows
:
30
def
__init__
(self):
31
import
msvcrt
32
33
def
__call__
(self):
34
import
msvcrt
35
return
msvcrt.getch()
36
37
getch =
_Getch
()
getch._GetchUnix.__init__
def __init__
Definition:
getch.py:14
getch._Getch.impl
impl
Definition:
getch.py:6
getch._GetchWindows.__call__
def __call__
Definition:
getch.py:33
getch._Getch
Definition:
getch.py:2
getch._Getch.__call__
def __call__
Definition:
getch.py:10
getch._GetchUnix.__call__
def __call__
Definition:
getch.py:17
getch._Getch.__init__
def __init__
Definition:
getch.py:4
getch._GetchWindows.__init__
def __init__
Definition:
getch.py:30
getch._GetchUnix
Definition:
getch.py:13
getch._GetchWindows
Definition:
getch.py:29
src
python
getch.py
Generated on Thu Dec 18 2014 16:11:54 for abc-master by
1.8.6