def getch():
"""
Interrupting program until pressed any key
"""
try:
import msvcrt
return msvcrt.getch()
except ImportError:
import sys
import tty
import 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
评论列表
文章目录