开发者

PyGTK: Controlling interface from within joined thread

开发者 https://www.devze.com 2023-01-23 08:45 出处:网络
I have a thread in PyGTK, inside my mainloop. It\'s a Timer, so it needed to be joined with .join(). The problem is, I now cannot edit my UI from in that thread - change text and so on - because of th

I have a thread in PyGTK, inside my mainloop. It's a Timer, so it needed to be joined with .join(). The problem is, I now cannot edit my UI from in that thread - change text and so on - because of the .join(). Is there a way I can change things from outside (well, you know what I mean) the开发者_如何学Python mainloop?

Thanks.


instead of using a Timer thread, use glib.timeout_add to do your thing. It works together with gtk's mainloop and runs in the same thread, so you don't have to do anything special.

0

精彩评论

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