Original report at SourceForge, opened Fri Dec 12 08:00:34 2008
I would like to suggest a modification of the
GTK Navigation Toolbar, in the SaveFigure option.
Unfortunately I am not capable of doing it myself.
The changes are (I thik so) in the "backend_gtk.py"
file and can be understood in the attached PDF. Both changes involve a Matplotlib function to set the
initial filename and extension. Unfortunatly I am not
capable of doing these changes in a "clean" way.
Strange that nobody answered this feature request.
I needed to predefine an initial file path and name to programatically find the saved images afterwards and implemented it for NavigationToolbar2 and the Tk backend.
If the feature request is accepted, I can suggest code for backends which support predefining an output path.
# Apps may suggest output folder and file name if save_figure() supports this
self.initialpath = ""
def set_initialpath(self, initialpath):
self.initialpath = initialpath
# TODO: Maybe allow function arguments for initialdir/file
initialdir, initialfile = os.path.split(self.initialpath)
initialdir, initialfile = None, None
fname = asksaveasfilename(
title='Save the figure',
filetypes = tk_filetypes,
initialdir = initialdir,
initialfile = initialfile,
defaultextension = defaultextension
This feature request (or something comparable) is being implemented in #908.
@rleonhardt: Thank you for taking the time to submit your patch. We are still at the reviewing stage of #908 so please feel free to get involved & make some suggestions.