开发者

Twisted + serial + GTK+ + win32eventreactor: GUI freezing

开发者 https://www.devze.com 2023-03-03 00:42 出处:网络
I\'m开发者_如何学Python trying to get my twisted program to work on windows (using twisted-serial, GTK+, and win32eventreactor), but the GUI freezes/doesn\'t load properly when I run it.

I'm开发者_如何学Python trying to get my twisted program to work on windows (using twisted-serial, GTK+, and win32eventreactor), but the GUI freezes/doesn't load properly when I run it.

It doesn't completely freeze though, because if I drag the GUI window back and forth a couple of times across the screen, the GUI actually appears. Tabs in the GUI don't work either, unless I click on a new tab, then drag the window a bit - the GUI then displays the new tab.

Does anyone know what the problem might be?

Thanks.


Any given program can only have one event loop running at a time (at least, per thread). If you're doing "reactor.run()", that means you can't run the gtk mainloop, and vice versa. This is why Twisted has a GTK reactor, to integrate the two event loops. Since you're using win32eventreactor, that won't work... So, you'll have to run each event loop in a separate thread, and make sure to communicate using the appropriate thread-safe APIs (reactor.callFromThread lets you schedule functions to run in the Twisted reactor thread in a thread-safe manner; presumably GTK has a similar API).

0

精彩评论

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