Python periodic timer interrupt
问题 (How) can I activate a periodic timer interrupt in Python? For example there is a main loop and a timer interrupt, which should be triggered periodically: def handler(): # do interrupt stuff def main(): init_timer_interrupt(<period>, <handler>); while True: # do cyclic stuff if __name__ == "__main__": main(); I have tried the examples found at Executing periodic actions in Python, but they are all either blocking the execution of main() , or start spawning new threads. 回答1: Any solution will