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?

--Michiel


--- On Sun, 2/14/10, David Arnold <dwarnol...@suddenlink.net> wrote:

> From: David Arnold <dwarnol...@suddenlink.net>
> Subject: [Matplotlib-users] Easy come easy go
> To: matplotlib-users@lists.sourceforge.net
> Date: Sunday, February 14, 2010, 11:36 PM
> All,
> 
> This example:  
> http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html
> 
> Raises this exception o my Macbook when the key 's' is
> pressed:
> 
> The debugged program raised the exception unhandled
> TypeError
> "save_figure() takes exactly 1 argument (2 given)"
> File:
> /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py,
> Line: 1703
> 
> David
> ------------------------------------------------------------------------------
> 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
> 


      

------------------------------------------------------------------------------
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