[wxPython-users] Re: xrc and wxStatusBar probs

Robin Dunn robin at alldunn.com
Sun Jun 18 13:23:36 PDT 2006


Marc Risney wrote:
>>
>> Here you gave self as first parameter (with self in the object itself,
>> its the second one). self is wx.app, but wx.window * is expected, so you
>> have to write:
>>
>> self.statusBar =
>> self.res.LoadObject(self.frame,"ID_STATUS_BAR","wxStatusBar")
>>
>>>         self.frame.SetStatusBar = self.statusBar
>>>         self.statusBar.SetStatusText("test",0)
>>>
> 
> I changed my method to:
> 
> def InitStatusBar(self):
>         self.statusBar = wx.StatusBar
>         self.statusBar = 
> self.res.LoadObject(self.frame,"ID_STATUS_BAR","wxStatusBar")


I know you've solved this a different way, but for future reference the 
XmlResource.Load* functions are only for top-level items within the XML. 
  Since your statusbar in this case was a child of the panel the 
LoadObject function is not going to see it.  Since it will already have 
been loaded as part of the frame then you can get a reference to it 
using XRCCTRL.

>         self.frame.SetStatusBar = self.statusBar
>         self.frame.SetStatusText("test",0)

However, since the statusbar was a child of the panel it can't be used 
in a call to SetStatusBar and so can't be managed directly by the frame.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list