I wanted to know what are pending events and idle callbacks because everywhere on the internet it is written that window.update() gets pending events and idle callbacks up to date, and I cannot understand the meaning of this.
1 Answers
Consider this line of code:
some_widget.configure(background="red")
When this code executes, the change won't happen immediately. Instead, the change is added to a queue of idle events. These events don't get processed until the next time something processes events on the queue.
Similarly, if you do something like root.after(1000, some_function)
, the call to some_function
is added to the idle queue and won't be processed until something processes the idle queue and at least 1000ms have elapsed.
Now, consider a canvas that does things when you click on it. If you click on it three times in rapid succession, tkinter can only process one event at a time. While it's processing the first click, the other two are pending. They are in the queue but won't actually get processed until either update
is called, or the code returns control to mainloop
.

- 370,779
- 53
- 539
- 685