[wxpython-users]Question about wx.EVT_WINDOW_CREATE and post-initializatons

甜瓜 littlesweetmelon at gmail.com
Thu Sep 13 00:35:27 PDT 2007


I am using XRC to generate py GUI code. Simply a wxFrame.

class MyFrame(xrcMAINFRAME):
    def __init__(self, parent):
        xrcMAINFRAME.__init__(self, parent)
        self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate)

I want to do some post-initializatons in self.OnCreate, but,
strangely, it was never called. Why cannot the frame capture
wx.EVT_WINDOW_CREATE?

2. If I want to do some post-initializatons JUST AFTER all widgets are
created and shown up?
My work around now is bind EVT_SHOW of the mainframe and use a boolean
flag to ensure post-initialization only once. Is there any better and
standard method for my purpose?

3. How to invoke a menu_item_click in program?
eg: self.Bind(wx.EVT_MENU, self.OnInit, mainmenu.IDM_INIT)
If the post-initialization is automatically call a menu handler
self.OnInit, how to trigger it in program? In Win32 API, I can use:
SendMessage(hwnd, ....) , how about wxPython?

Thank you.
--
ShenLei




More information about the wxpython-users mailing list