On dimanche 05 octobre 2008, jcarnes wrote:
> I am writing a GUI application in wxPython and using MPL that plots
> figures, saves them to image files, and then closes them all from within a
> thread to keep the GUI responsive.

   Normally only the main thread should alter the graphics - you'll have 
crashes if you try to do it otherwise. If you want to perform calculations in 
a separate thread to keep the GUI responsive, you have to send an event from 
the working thread to the main thread, so that the main thread does the GUI 
update.

http://docs.wxwidgets.org/stable/wx_wxthreadoverview.html#wxthreadoverview

   Well, at least that's the story from my C++ wx knowledge, but it is 
probably still valid in Python.

Another interesting read from the samples page:
http://docs.wxwidgets.org/trunk/page_samples.html#page_samples_thread

  Maybe simply using wxMutexGUIEnter() / wxMutexGUILeave() will sort your 
problems, but I've not tried this method.

        Vincent
-- 
Vincent Favre-Nicolin

CEA Grenoble/INAC/SP2M                  http://inac.cea.fr
Univ. Joseph Fourier (Grenoble) http://www.ujf-grenoble.fr

ObjCryst & Fox                  http://objcryst.sf.net/Fox

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to