I'm doing a net app that is quite intensive in it's background activity. I'm using a few Queue's to manage the communication between my threads, the wxPython one of course being the "main" thread. The following pseudo-snippet shows the basic way that I'm managing the interaction between my gui and my workers. Is the basic correct method? (It's really psuedo-code, as the real thing is a bit more complicated.) If you can tell from this limited example, am I on the right path? It seems that sometimes the gui freezes until I move the mouse or touch a key. If this is too little to go on, I can try to put together a more realistic mini-prog for demonstration.
In your onIdle() event, replace wxWakeUpIdle() with event.RequestMore()
which should also be conditional. So if queue.get() raises the "empty
exception" you're done. Otherwise, DoSomeStuff() and
event.RequestMore().
See wxIdleEvent in the class reference docs for the official details.
HTH,
···
On Tuesday 27 May 2003 11:24 pm, Scott wrote:
I'm doing a net app that is quite intensive in it's background
activity. I'm using a few Queue's to manage the communication
between my threads, the wxPython one of course being the "main"
thread. The following pseudo-snippet shows the basic way that I'm
managing the interaction between my gui and my workers. Is the basic
correct method? (It's really psuedo-code, as the real thing is a bit
more complicated.) If you can tell from this limited example, am I on
the right path? It seems that sometimes the gui freezes until I move
the mouse or touch a key. If this is too little to go on, I can try
to put together a more realistic mini-prog for demonstration.
I'm doing a net app that is quite intensive in it's background activity. I'm using a few Queue's to manage the communication between my threads, the wxPython one of course being the "main" thread. The following pseudo-snippet shows the basic way that I'm managing the interaction between my gui and my workers. Is the basic correct method? (It's really psuedo-code, as the real thing is a bit more complicated.) If you can tell from this limited example, am I on the right path? It seems that sometimes the gui freezes until I move the mouse or touch a key. If this is too little to go on, I can try to put together a more realistic mini-prog for demonstration.
You should call wxWakeUpIdle when things are added to the queue. Doing it in the OnIdle handler has no effect. Also, as Chuck mentioned, call event.RequestMore if there are things still in the queue.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!