Home > Net >  Tkinter - Event Queue and order of events
Tkinter - Event Queue and order of events

Time:11-14

I tried to figure out how the event queue is processed in tkinter. I found enter image description here enter image description here

CodePudding user response:

To order the Event Queue of tkinter one have either to bypass all events and trigger them in the prefered order. Or works with a specific type of event, means a sepecific flag. Otherwise tkinters Notifier will process the order of events like below. Another solution for people of tcl knowlege would be to write a own Notifier like described here.

Tcl_Notifier
  |
  |
  |

Tcl_DoOneEvent ------ ----> get_first/oldest from Tcl_WINDOW_EVENTS (processes msg of WM)
  ^                  |
  |                   ----> get_first/oldest from Tcl_FILE_EVENTS (tk.Tk.createfilehandler)
  |                  |
  |                   ----> get_first/oldest from Tcl_TIMER_EVENTS (after)
  |                  |
  |                   ----> get_first/oldest from Tcl_IDLE_EVENTS (after_idle)
  |                  |
  |                   ----> get_first/oldest from Other event sources (virtual events)
  |                  |
  |                   ----> Tcl_SetTimer(time|maxtime) ----> Tcl_WaitForEvent ---- 
  |                                                                               |
   ------------------------------------------------------------------------------- 

BTW, there are some additional conclusions:

  • If after maxtime the command Tcl_DoOneEvent cant be invoked there will be a runtime error.
  • Related