SaveFig bug in TkAgg backend

This is a well known problem, reported about a year or so ago.
John Hunter tried to get some help on the (TK?) mailinglist, but I
don't think anybody responded. I looked into it too, but couldn't find
a solution (that doesn't mean much, except for that it is not
blatently obvious).
It would be great if somebody would know how to fix this.
Strangely enough I have written a GUI myself where I use the toolbar,
and the save button works fine there.
Mark

···

Date: Thu, 10 May 2007 13:31:18 -0600
From: "Urvashi R.V." <urvashi.rau@...149...>

Hi,

When the "save" button is used on the matplotlib tkagg toolbar, it
uses the "Tk" "asksavefilename" object from the "tkFileDialog" class,
to pop up a little window that allows you to select the name and type
of file to save. This function internally calls "figure.destroy()".
and the currently active figure gets destroyed (but it is still visible
and memory is not freed). The next plot then creates a new figure
window with the same figure._num as the previous.

see...
backend_tkagg.py : line 621
-> class NavigationToolbar2TkAgg :: def save_figure(...)
(callback for the toolbar.bsave button)

The "asksavefilename" function call, triggers Gcf.destroy(). This can
be seen by placing a print statement in
_pylab_helpers.py : line 16
-> class Gcf :: def destroy(num)

We don't have anyone at the moment that can work on it, but I think on the order of a month or two we can. We see similar issues too. So if someone can deal with it before then, that would be great, but we'll tackle it before very long if not.

Perry

···

On May 18, 2007, at 7:21 AM, Mark Bakker wrote:

This is a well known problem, reported about a year or so ago.
John Hunter tried to get some help on the (TK?) mailinglist, but I
don't think anybody responded. I looked into it too, but couldn't find
a solution (that doesn't mean much, except for that it is not
blatently obvious).
It would be great if somebody would know how to fix this.
Strangely enough I have written a GUI myself where I use the toolbar,
and the save button works fine there.
Mark

Excellent, Perry.
Thanks for your help,
Mark

···

On 5/18/07, Perry Greenfield <perry@…31…> wrote:

We don’t have anyone at the moment that can work on it, but I think
on the order of a month or two we can. We see similar issues too. So

if someone can deal with it before then, that would be great, but
we’ll tackle it before very long if not.

Perry

On May 18, 2007, at 7:21 AM, Mark Bakker wrote:

This is a well known problem, reported about a year or so ago.

John Hunter tried to get some help on the (TK?) mailinglist, but I
don’t think anybody responded. I looked into it too, but couldn’t find
a solution (that doesn’t mean much, except for that it is not

blatently obvious).
It would be great if somebody would know how to fix this.
Strangely enough I have written a GUI myself where I use the toolbar,
and the save button works fine there.

Mark