python glib main loop: delaying until loop is entered
Is t开发者_开发问答here a way to schedule the execution of a callable until the glib main loop is entered?
Alternatively, is there a signal I can subscribe to that will indicate that the main loop is entered?
You can use gobject.idle_add which will schedule a callable to be executed when the main loop is idle. gobject.timeout_add is an alternative which uses a timer.
Mind that the callable will be called again and again, unless is returns False
(or anything that resolves to False
, like None
).
精彩评论