I'm trying to display a value on the status bar according to a position on a plot made on a panel. So I want to call the method SetStatusText with the value in a string. The instance of RefreshPanel is set within a frame called 'frame', which is an instance of a subclass MyFrame of wx.Frame in which the status bar is set. But when I left click in the plot on the panel I get
line 51, in OnLeftDown
frame.SetStatusText("%.1f kHz" % freqkhz)
AttributeError: 'builtin_function_or_method' object has no attribute 'SetStatusText'
class RefreshPanel(wx.Panel):
def __init__(self, parent, id, pos, size):
wx.Panel.__init__(self, parent, id, pos, size)
global xaxis,yaxis,z
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown
def OnLeftDown(self, event):
"""left mouse button is pressed"""
pt = event.GetPosition() # position tuple
freqkhz = (600 - pt[1])/500.0/1000.0*(yaxis[-1]-yaxis[0])
print "%.1f kHz" % freqkhz
frame.SetStatusText("%.1f kHz" % freqkhz)