SaveFig bug in TkAgg backend

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)

A script to trigger this is attached
Does anyone else see this, and does anyone have a way to fix this ?

Thank you very much !
Regards,
Urvashi Rau

savetest.py (565 Bytes)