wxreactor/wxpython does not work well together - GUI "hangs"
|Reported by:||robertckcheung||Owned by:|
OS: Windows XP Twisted 2.0.1 Python 2.3.4 and 2.3.5 wxPython 18.104.22.168
Hi, we have been using wxReactor in a wxPython application. While it works MOST of the time on MOST machines, we have found that on certain machines (mainly virtual machines and machines with slow graphics cards), the creations of "large" GUIs causes the programs to "hang". ie a process that should take say 1 second might take 5-10 minutes. Furthermore, it turns out that if you "force" GUI refreshes by waving another window in front of the application's GUI, it speeds things up (ie it might take around 5 seconds to create the GUI).
Whilst we have not discovered the root of this problem, we are lead to believe it is some sort of GUI refresh race condition. So by tweaking line 49 of twisted/internet/wxreactor.py to say -
self.Start(100) instead of self.Start(1)
fixed our problems.
Speculation: The 1 millisecond timer is far too agressive and calling the paint function of wxPython this rapidly causes a serious race condition. When we make the calls to wxPython every 100ms instead the race condition disappeared (not saying it cannot happen under a different condition).
Request: Change wxreactor.py to use a more conservative timer (100ms works for us).