Dec-07-2020, 09:52 PM
how can i get this to just interrupt the input and continue down the while true loop. instead if there is no input after 3 seconds it end the program.
class FiveSec(threading.Thread): def restart(self): self.my_timer = time.time() + 3 def run(self, *args): self.restart() while 1: time.sleep(0.1) if time.time() >= self.my_timer: break os.kill(os.getpid(), signal.SIGINT) def main(): try: t = FiveSec() t.daemon = True t.start() x = input('::> ') return x except KeyboardInterrupt: print("\nDone!") while True: if "hi" in main(): print("hi") print("hello") x = 2+2 print(x)