Accessing child objects during two stage creation

Hello all,

I have a question regarding two stage creation. The files I will be
referring to are reproduced below.

In mygui.py I have a wxApp subclass, MyApp. MyApp's OnInit loads a
subclassed wxFrame from an XRC file (subclass defined in mymod/gui.py).

In the constructor of the wxFrame subclass (i.e. MyFrame.__init__) I would
like to set up event handlers and whatnot. But I can't see the child objects
of the frame at this stage.

However, once MyFrame.__init__() has returned, I can see the child objects
just fine.

Running mygui.py, I see the following output:

None
<wx._core.MenuBar; proxy of C++ wxMenuBar instance at _00ff4201_p_wxMenuBar>

At first the menubar is "invisible" and then later it appears (presumably it
gets added once it has been constructed).

Is there some way to have wx call a MyFrame method at this stage (i.e. when
all the children have been created) so I can complete the initialisation of
my object? Or is the best I can do to call another method after constructing
the object with LoadFrame (like I call foo() in this example)?

Alternatively, is there a better way of adding event handlers and whatnot
when loading a frame from an XRC file?

== mygui.py ==
import wx
import wx.xrc
import mymod
class MyApp(wx.App):
    def OnInit(self):
        self.res = wx.xrc.EmptyXmlResource()
        self.res.Load('mygui.xrc')
        frame = self.res.LoadFrame(None, "MyFrame")
        frame.foo()
        frame.Show()
        return True
def main():
    app = MyApp(False)
    app.MainLoop()
if __name__ == '__main__':
    main()

== mymod/__init__.py ==
from gui import *

== mymod/gui.py ==
import wx
class MyFrame(wx.Frame):
    def __init__(self):
        pre = wx.PreFrame()
        self.PostCreate(pre)
        print self.GetMenuBar()
    def foo(self):
        print self.GetMenuBar()

== mygui.xrc ==
<?xml version="1.0" encoding="ISO-8859-1"?>
<resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc&quot;&gt;
  <object class="wxFrame" name="MyFrame" subclass="mymod.MyFrame">

<style>wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX

wxCLOSE_BOX</style>

    <size>640,480</size>
    <title>myframe</title>
    <object class="wxMenuBar" name="MainMenuBar">
      <object class="wxMenu">
        <object class="wxMenuItem">
          <label>MenuItem</label>
        </object>
        <label>Menu</label>
      </object>
    </object>
  </object>
</resource>

Thanks.

Regards,

Albert