x or q to exit
This commit is contained in:
@@ -90,9 +90,12 @@ def drawdigital(win,y,x,t):
|
|||||||
|
|
||||||
def readinput(win):
|
def readinput(win):
|
||||||
try:
|
try:
|
||||||
return win.getch()
|
input=win.getch()
|
||||||
|
if input in [ord(x) for x in ['x','X','q','Q']]:
|
||||||
|
return "x"
|
||||||
except:
|
except:
|
||||||
return ""
|
return ""
|
||||||
|
return ""
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
stdscr=curses.initscr()
|
stdscr=curses.initscr()
|
||||||
@@ -119,7 +122,7 @@ def main():
|
|||||||
signal.signal(signal.SIGALRM, readinput)
|
signal.signal(signal.SIGALRM, readinput)
|
||||||
signal.alarm(int(options.refresh))
|
signal.alarm(int(options.refresh))
|
||||||
userinput=readinput(stdscr)
|
userinput=readinput(stdscr)
|
||||||
if userinput!="":
|
if userinput=="x":
|
||||||
curses.nocbreak()
|
curses.nocbreak()
|
||||||
stdscr.keypad(0)
|
stdscr.keypad(0)
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
|
|||||||
Reference in New Issue
Block a user