Hello all
I'm trying to add a custom button in the navigation toolbar for a wx app.
so far, I can add the button, but can't get it to work. here is a
snippet of the code (the classes are in the same file):
#custom matplotlib navigation toolbar
#from: http://www.nabble.com/Re%3A-Navigation-toolbar-w-o-subplot-configuration-button-p18754379.html
class VMToolbar(NavigationToolbar2WxAgg):
def __init__(self, plotCanvas):
NavigationToolbar2WxAgg.__init__(self, plotCanvas)
self.SetToolBitmapSize(wx.Size(12,12))
app_ico = application.getBitmap()
drawButtonNT = self.AddLabelTool(-1, 'Plot', app_ico,
wx.NullBitmap, wx.ITEM_NORMAL,'Draw/Clear Stereonet')
# delete unwanted tools
self.DeleteToolByPos(6) # Configure subplots
self.DeleteToolByPos(3) # Pan
self.Bind(wx.EVT_TOOL, StereoPanel.PlotStereonett, drawButtonNT)
class StereoPanel(wx.Panel):
"""class for the second page of the notebook """
def __init__(self, parent):
wx.Panel.__init__(self, parent, style=wx.BORDER_SUNKEN)
#... some code
#creates / redraws the stereonet
def PlotStereonett(self, event):
"""Create the Stereonet """
axes = self.plotaxes
print 'it works!!'
This gives me this error:
TypeError: unbound method PlotStereonett() must be called with
StereoPanel instance as first argument (got CommandEvent instance
instead)
TIA
Carlos
···
--
Carlos Henrique Grohmann - Geologist D.Sc.
a.k.a. Guano - Linux User #89721
ResearcherID: A-9030-2008
carlos dot grohmann at gmail dot com
http://www.igc.usp.br/pessoais/guano/
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
Can’t stop the signal.