def delayfunc(msecs): msecs = int(msecs) # # Check for immediate stdwin event # event = stdwinq.pollevent() if event: mainloop.dispatch(event) return # # Use sleep for very short delays or if there are no windows # if msecs < 100 or mainloop.countwindows() == 0: if msecs > 0: time.sleep(msecs * 0.001) return # # Post a timer event on an arbitrary window and wait for it # window = mainloop.anywindow() window.settimer(msecs/100) event = stdwinq.getevent() window.settimer(0) if event[0] <> WE_TIMER: mainloop.dispatch(event)
def do_quit(win): # Call win.dispatch instead of do_close because there # may be 'alien' windows in the list. for win in mainloop.windows[:]: mainloop.dispatch((WE_CLOSE, win, None))
def run(): while not empty(): if q.empty(): mainloop.dispatch(stdwinq.getevent()) else: q.run()
def Dispatch(event): mainloop.dispatch(event)