Just to make sure, pylab.show() interacts with the GUI, right?

Most GUIs, including Qt if I remember right, are not multithreaded, meaning 
you've got one GUI thread running the GUI main event loop, and any manipulation 
of the GUI does need to happen from there.
(One usually has mechanisms to inject events/work into the event loop, and to 
push out work into other threads, ...)

My recommendation would be to run it with three separate PyRun_SimpleString() 
and see where it blocks.

Some locking considerations:

* import does internally locking.
* If pylab.show() does use Qt GUI functionality, it will almost burn (that can 
also include failure modes like blocking) for sure.
* If pylab.plot() is the long running thing, then consider calling pylab.plot() 
in a separate thread, and when done pylab.plot() in the GUI/main thread.

The usual way to keep a GUI responsive during long work, if work involves the 
GUI is to make "yield to process GUI events" calls in you inner loop. (the 
exact naming depends again on the GUI). This way the GUI is handled and stays 
responsive, while your work can proceed.

Regards,

Andreas


The information contained in this e-mail message is privileged and
confidential and is for the exclusive use of the addressee. The person
who receives this message and who is not the addressee, one of his
employees or an agent entitled to hand it over to the addressee, is
informed that he may not use, disclose or reproduce the contents
thereof, and is kindly asked to notify the sender and delete the e-mail
immediately.


_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to