How to insert a new button?

Hi
I would like to insert a new button on the standard figure toolbar,
is there an easy way? maybe someone can post an example?
Thanks

···


View this message in context: http://www.nabble.com/How-to-insert-a-new-button--tp20348834p20348834.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

sordnay schrieb:

Hi
I would like to insert a new button on the standard figure toolbar, is there an easy way? maybe someone can post an example

This depends on the backend/GUI toolkit you use. If you use wx, a simple approach might be the following:

···

------------------
from pylab import *
import wx

def Action(event):
    print "you pressed me!"

fig = figure()
toolbar = fig.canvas.toolbar

ID_MY_ACTION = wx.NewId()
toolbar.AddLabelTool(ID_MY_ACTION,
                     'Autoscale',
                     wx.Bitmap('autoscale.png', wx.BITMAP_TYPE_PNG)
                     )
toolbar.Realize()

toolbar.Bind(wx.EVT_TOOL, Action)

show()
--------------------

Gregor

Thanks for your answer Gregor,

I'm using TkAgg backend, I hope is also that simple there!

Gregor Thalhammer-2 wrote:

···

This depends on the backend/GUI toolkit you use. If you use wx, a simple
approach might be the following:

------------------
from pylab import *
import wx

def Action(event):
    print "you pressed me!"

fig = figure()
toolbar = fig.canvas.toolbar

ID_MY_ACTION = wx.NewId()
toolbar.AddLabelTool(ID_MY_ACTION,
                     'Autoscale',
                     wx.Bitmap('autoscale.png', wx.BITMAP_TYPE_PNG)
                     )
toolbar.Realize()

toolbar.Bind(wx.EVT_TOOL, Action)

show()
--------------------

Gregor

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/How-to-insert-a-new-button--tp20348834p20358744.html
Sent from the matplotlib - users mailing list archive at Nabble.com.