def _getch(self):
'''Getch a character from stdin'''
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
ch = None
while self._state:
try:
tty.setraw(fd)
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
if ch:
if ch == 'q':
self._state = False
self.manageEvent('exit')
else:
self.manageEvent(ch)
评论列表
文章目录