On Wed, Feb 17, 2010 at 7:41 AM, Michiel de Hoon <mjldeh...@yahoo.com> wrote:
> An inconsistency in the definition of save_figure between different backends 
> is causing this problem.
>
> The GTK backends use
>    def save_figure(self, button):
>
> but the tkagg, qt, qt4, and macosx backends use
>    def save_figure(self):
>
> so without the second argument. The line that is causing the error is
>
>            self.canvas.toolbar.save_figure(self.canvas.toolbar)
>
> in backend_bases.py. This assumes that the save_figure method is defined as 
> in the GTK backends.
>
> As far as I can tell, the GTK backend has the second argument because that is 
> what pygtk passes when save_figure is called as a callback. The second 
> argument is not actually used inside the method.
>
> So I would suggest the following:
>
> In backend_bases.py, change the offending line to
>
>            self.canvas.toolbar.save_figure()
>
> and the backend_gtk, change the definition of the save_figure method to
>
>    def save_figure(self, button-None):
>
> Any objections, anybody?


The base class signature is

    def save_figure(self, *args):
        'save the current figure'
        raise NotImplementedError

But I think the problem is the line

  self.canvas.toolbar.save_figure(self.canvas.toolbar)

it shouldn't be passing the toolbar in, but should just read

  self.canvas.toolbar.save_figure()

We could make both changes -- make sure all the signatures of the
derived classes comply with

     def save_figure(self, *args):

and remove the self.canvas.toolbar argument from the save_figure call.

Michiel, do you want to take the lead on this?

JDH
No?

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to