summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Holland <william.holland@codethink.co.uk>2015-06-07 13:43:28 +0100
committerWilliam Holland <william.holland@codethink.co.uk>2015-06-07 13:43:28 +0100
commit5eb9aade42d257125ac80e564b4a20c1ba4499d6 (patch)
tree12de5edaf05732e165468cbaee2de8fd976cfbc1
parentcc20e02878cf7482dec6a42392dff68616fddae8 (diff)
downloadkeyboard-python-5eb9aade42d257125ac80e564b4a20c1ba4499d6.tar.bz2
Rename set_to_read_key and reset for clarity
To init and close
-rw-r--r--keyboardpython/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/keyboardpython/__init__.py b/keyboardpython/__init__.py
index a12f6c7..9a00be0 100644
--- a/keyboardpython/__init__.py
+++ b/keyboardpython/__init__.py
@@ -37,11 +37,11 @@ def cbreak(on=True):
def nocbreak():
cbreak(False)
-def set_to_read_key(fd='default'):
+def init(fd='default'):
''' Set tty so that os.read gets one keypress at a time '''
import sys,termios
# VMIN min bytes read before returning from os.read()
- VMIN = 1 # 0 for pure timed read
+ VMIN = 1
# VTIME tenths of a second elapses between bytes read
VTIME = 1
if fd == 'default': fd = sys.stdin.fileno()
@@ -55,8 +55,8 @@ def set_to_read_key(fd='default'):
cc[termios.VTIME] = VTIME
termios.tcsetattr(fd, termios.TCSANOW, t)
-def reset_tty(fd='default'):
- ''' set tty to how it was before set_to_read_key '''
+def close(fd='default'):
+ ''' set tty to how it was before init '''
import sys,termios
if fd == 'default': fd = sys.stdin.fileno()
termios.tcsetattr(fd, termios.TCSANOW, before_t)