On 08/25/13 19:12, Goyo wrote:
>
>> Thank you. I'd like to stick to pure OO, but I'm using some
>> third party open source code that uses pylab extensively for
>> rather large and interactive (as in "includes scrollbars,
>> buttons and several types of events") figures. The code
>> works nicely in itself, and has an option to return the
>> figure object without actually showing the plot.
>>
>> I was hoping to take the returned figure as an object and
>> reset the related state environment information, effectively
>> "smuggling" the created figure out of the state environment.
>> If there is a simple way to do this in Matplotlib, that
>> would be quite useful.
> Does pyplot.close(fig) not do what you need?
>
> Goyo

The problem is when to call pyplot.close(fig). The actual visible figure 
on the canvas is often resized along with window it is in, in addition 
to being interacted with in other ways. In these cases you can't just 
close the figure after drawing it - if you do, the resizing results in a 
blank canvas and a PyDeadObjectError.

The easiest workaround to the problem is simply making the whole window 
modal, and closing the figure if the window is closed for any reason - 
or before you create a new figure. This is less than ideal, but lets the 
life go on in this case.

Kari

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to