I have a GTK window. It turns out that if I schedule several redraw calls all at once, without any delay, from a separate thread, using idle_add(window.queue_draw)
, only one call will execute.
While if I do idle_add(custom_function)
, every single scheduled call to custom_function will run.
While it's clear that this is done for optimization, I can't see if/where this is mentioned in the documentation [1] and I also wonder if there are other such rules for idle_add
.
[1] https://developer.gnome.org/pygobject/stable/glib-functions.html
It actually isn't idle_add
that is making that behavior. The docs for widget-queue-draw-region, which gets called by queue-redraw
, state that redrawing only gets done after the main loop is no longer busy.