Thanks for your help!
I'm not sure how I should go about overriding the existing method. Say
I have the following custom savefig():
def savefig(self, evt):
print "Hello world"
and a figure() instance fig, how do I actually tell
fig.canvas.manager.frame.toolbar.save to actually point to my custom
On 28 Apr 2009, at 11:57, John Hunter wrote:
> On Tue, Apr 28, 2009 at 8:21 AM, Thomas Robitaille <thomas.robitaille@...
> > wrote:
> I was wondering if it is possible to override the 'save' button in
> wxAgg so that once a filename has been specified in the dialog, a
> custom function is run instead of the default savefig? Maybe this
> would require too much hacking?
> You could probably override the
> matplotlib.backends.backend_wx.NavigationToolbar2.save function. If
> you are using pylab/pyplot, this function is accessible as
> In : fig.canvas.manager.frame.toolbar.save
> Out: <bound method NavigationToolbar2WxAgg.save of
> <matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg; proxy of
> <Swig Object of type 'wxToolBar *' at 0x3b5bc60> >>
> and has the signature::
> def save(self, evt):
> where evt is the GUI event that generated the callback (can safely
> be ignored).
> If you are embedding mpl in wx directly, you can create your own
> toolbar as in the embedding_in_wx* examples at