def check_key(): if msvcrt is None: return False else: if msvcrt.kbhit()!=0: q=msvcrt.getch() return q in "q" else: return False