Issue with wxPython GUI

Laszlo Nagy gandalf at shopzeus.com
Tue Nov 13 08:44:26 CET 2007


>
> *New Problem: *I am opening and executing a script from the GUI. The 
> script has a many log messages,
> which it posts on some shared memory. The GUI reads the messages from 
> the shared memory,
> in the Idle loop. But the script is huge and so the logging is not 
> run-time.
> Rather this happens only after the script has executed. Moreover, the 
> GUI becomes
> un-responsive till the script has completely executed.
>
This is (probably) because you are running your script in your main 
thread. While the main thread of the application is running, your 
windowing system cannot process message queues. Since the updating of a 
text control uses window messages, it has no chance to process them. I 
recommend that you run your script in a separate (terminateable?) 
thread, send your messages into a Queue instance, and load messages from 
that queue in your main thread.
>
> Do you have any suggestions for this?
Well, if you do not want to create more threads, it migth work if you 
call this periodically from your main thread (but I did not try this):


      wxApp::Dispatch

*virtual void* *Dispatch*()

Dispatches the next event in the windowing system event queue.

This can be used for programming event loops, e.g.

  while (app.Pending())
    Dispatch();





More information about the Python-list mailing list