event.wait(time) After waiting time, execute the next step. Or do the next step immediately after calling event.set().
event.clear() clears the signal
event.set() sets the signal
event.isSet() to determine whether to set the signal
Require:
Define a button, wait 3 seconds, and if it is not clicked again for 3 seconds, go to the next step. Otherwise, wait 3 seconds again.
define the execution function
def demo(): event.set() event.clear() if event.wait(3): pass else: print("do the action")
Simulate multithreaded calls
for x in range(10): print("start demo") t = Thread(target=demo) t.start()