Still fooling around with sample code to see how wx works.
I've created a panel by subclassing wx.Panel. The panel is populated
with various controls that trigger events. The events are handled in
methods that are members of my panel subclass.
Then I instantiate a new app. I create a frame and call the frame's
CreateStatusBar() method.
Question: how do I pass text info from the panel's event handler methods
to the frame's status bar?
Thanks in advance!
Scott
Here's some code:
class Form1(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
# button
self.button = wx.Button(self, 10, "Save", wx.Point(200, 325))
wx.EVT_BUTTON(self, 10, self.OnClick)
def OnClick(self,event):
self.logger.AppendText(" Click on object with Id %d\n" %event.GetId())
# --> this doesn't work <--
sbar = wx.StatusBar(None)
sbar.SetStatusText('EvtRadioBox: %d\n' % event.GetInt())
app = wx.PySimpleApp()
# set frame parent, id, title, pos, size
frame = wx.Frame(None, -1, "Our first control", wx.Point(200, 100), wx.Size(600, 400))
frame.CreateStatusBar()
# add panel, Form1, to frame
Form1(frame, -1)
# show frame & run main loop
frame.Show(1)
app.MainLoop()