Dear all,
I have two suggestions about toolbar customization:
1. In the 'matplotlibrc' file the toolbar line should be changed in order to include a "custom toolbar"
toolbar : toolbar2 # None | classic | toolbar2 | custom
2. In the 'backend_tkagg.py file', inside the 'NavigationToolbar2TkAgg class' the
save_figure procedure should be changed to somewhat:
def save_figure(self):
from tkFileDialog import asksaveasfilename
fname = asksaveasfilename(master=self.window,
title='Save the figure',
filetypes=[('Encapsulated Postscript File','*.eps'),
('Scalable Vector Graphics','*.svg'),
('Portable Network Graphics','*.png')])
# initialfile=InitialFilename)
if fname == "" :
return
else:
bname, fext = os.path.splitext(fname)
if (fext.lower()=='.png'):
self.canvas.print_figure(fname, dpi=300)
elif (fext.lower()=='.eps'):
self.canvas.print_figure(fname)
elif (fext.lower()=='.svg'):
self.canvas.print_figure(fname)
I think that the asksaveasfilename function provided by tkFileDialog is "better"
3. In the code above there are three problems that I don't know how to solve (I am a Python newbie):
a) this solves only one backend...
b) I would like to provide the 'asksaveasfilename' an InitialFilename, such as in the commented line.
c) It would be much better to make my customizations by defining a "custom toolbar" instead of
tweaking the original one...
Thanks,
Clovis Goldemberg