Scott Frankel:
I suggest you call frame.CreateStatusBar() in frame.__init__() and associate the statusbar to your frame with frame.SetStatusBar(), call GetStatusBar when you need it instead of creating a new one.
======= 2005-03-11 08:08:42 Scott Frankel wrote: =======
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!
ScottHere'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()---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org.
= = = = = = = = = = = = = = = = = = = =
Bruce Who
HuXuZhao@hotmail.com
2005-03-11