开发者

python glib main loop: delaying until loop is entered

开发者 https://www.devze.com 2022-12-20 10:47 出处:网络
Is t开发者_开发问答here a way to schedule the execution of a callable until the glib main 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消