[Twisted-Python] GUI responsiveness

Antoine Pitrou solipsis at pitrou.net
Wed Sep 14 05:35:35 MDT 2005


> The problem here is not Twisted and GUIs, the problem is wxPython.
> While superficially appealing and very featureful, wxPython integrates
> *very* poorly with a foreign event loop and has no facility for
> integrating network I/O.
> 
> Using GTK+ with Twisted, for example, is completely trivial, and
> requires no such threading hacks.

Never tried GTK with Twisted, but I don't understand how you can say
that generally.
Suppose a network event is taking some time to process (e.g. the
protocol is complex and there are some calculations involved), then your
GUI will become unresponsive (a 100ms delay is not critical for most
Internet protocols, but it is for GUIs).
Suppose there are lots of network events coming in, which flood the
event loop for a short time. When will GUI events be processed ? Again,
a 100ms delay will feel very annoying for the user (and more than 1
second delay is awful).
On the other hand, if you have one thread for networking and one thread
for the GUI, the OS can take care of the scheduling priorities
naturally, using its sophisticated builtin mechanisms (e.g. noticing
that one thread is "interactive" while the other is not), so you don't
have to rewrite/emulate/composate for the lack of/ them.

Am I missing something here ?

Regards

Antoine.






More information about the Twisted-Python mailing list