jcarnes schrieb:
> 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. Using the Enthought 2.3 install I would
> sporatically have crashes that were hard to reproduce, but now that I've
> upgrade to Enthought 2.5 (Python 2.5 and MPL 0.91.2.0001) it started
> throwing exceptions when attempting to close a figure that I don't
> understand. I've created an example script that excites the exception. I'm
> not sure if the syptoms are a combination of problems caused by my use of
> threads but this problem does not occur if threading is removed from the
> script. I've read of others experiencing memory leaks and such when closing
> figures, but no situations quite like this.
>
> I am working from a desktop in Windows XP and I use the WXAgg backend.
>
> Does anyone have any ideas, or any feedback on my use of threads? Thanks,
> Josh
>   

wxPython and multithreading don't go well together. Have a look at the 
wxWidgets docs about multithreading. Changes to the GUI (this includes 
closing a window) should only be done from the main thread.

Continously creating and destroying a figure window seems not necessary 
in your application. Create it once in the main thread ((have a look at 
the embedding_in_wx examples of matplotlib) and  only clear/replot it in 
your thread. In my experience replotting from the main thread is fast 
enough, saving to a file takes more time, this is worth to be done in 
another thread.

Gregor

-------------------------------------------------------------------------
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