Issue with wxPython GUI

tarun tarundevnani at gmail.com
Tue Nov 13 11:48:08 CET 2007


Hi Laszlo Nagy,

Thanks a lot.
But the issue over here is that how will the child thread acknowledge the
main thread that it has completed its task. For this I'll have to set some
flag in the child thread and poll for it in the main thread. This will
create a problem. Any alternatives??

Thanks & Regards,
Tarun


On 11/13/07, Laszlo Nagy <gandalf at shopzeus.com> wrote:
>
>
> >
> > *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();
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071113/371eadc0/attachment.html>


More information about the Python-list mailing list