Hmm, problems with html, will try again in plain text:

I'm trying to override the behaviour of the toolbar, with partial success.

This works:


from matplotlib.backend_bases import NavigationToolbar2

home = NavigationToolbar2.home

def new_home(self, *args, **kwargs):
    print 'home pressed'
    home(self, *args, **kwargs)

NavigationToolbar2.home = new_home




...but this doesn't:




from matplotlib.backend_bases import NavigationToolbar2

save_figure = NavigationToolbar2.save_figure

def new_save(self, *args, **kwargs):
    print 'save_figure pressed'
    save_figure(self, *args, **kwargs)

NavigationToolbar2.save_figure = new_save



Having actually created a figure, I can get a bound method for save_figure:


get_current_fig_manager().toolbar.save_figure()


This I can override, and call my override function successfully from my
script - but pressing the save button on the toolbar doesn't call my
function...

I'm running matplotlib 1.1.1rc and python 2.7.3

Thanks,

Will








On Wed, Apr 10, 2013 at 11:55 AM, Willw <will.woo...@gmail.com> wrote:

> I'm trying to override the behaviour of the toolbar, with partial success.
>
> This works:
>
>
>
> ...but this doesn't:
>
>
>
> Having actually created a figure, I can get a bound method for save_figure:
>
>
>
> This I can override, and call my override function successfully from my
> script - but pressing the save button on the toolbar doesn't call my
> function...
>
> I'm running matplotlib 1.1.1rc and python 2.7.3
>
> Thanks,
>
> Will
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Overriding-Save-button-on-Toolbar-tp40864.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to