When I run the following sample code and press just "q", it'll ends properly, but if I pressed any other characters "for instance many breaks and a lot of other characters" and then press "q" it'll not exit, how can I solve this?
import curses, time
def main(sc):
sc.nodelay(1)
while True:
sc.addstr(1, 1, time.strftime("%H:%M:%S"))
sc.refresh()
if sc.getch() == ord('q'):
break
time.sleep(1)
if __name__=='__main__': curses.wrapper(main)