[wxPython-users] pywxrc generates wrong python code.

甜瓜 littlesweetmelon at gmail.com
Tue May 1 07:21:43 PDT 2007


In wxPython v2.8.3:
I use xrcedit to create a main menu, and then use pywxrc script to
generate .py code. As below for menu part:
========
class xrcMAINMENU(wx.MenuBar):
    def PreCreate(self, pre):
        """ This function is called during the class's initialization.

        Override it for custom setup before the window is created usually to
        set additional window styles using SetWindowStyle() and
SetExtraStyle()."""
        pass

    def __init__(self, parent):
        # Two stage creation (see
http://wiki.wxpython.org/index.cgi/TwoStageCreation)
        pre = wx.PreMenuBar()   #!!!!!!ERROR!!!!!
        self.PreCreate(pre)
        get_resources().LoadOnMenuBar(pre, parent, "MAINMENU")
        self.PostCreate(pre)

        # Define variables for the controls
        self.IDM_CONNECT = self.FindItemById(xrc.XRCID("IDM_CONNECT"))
========
But wx module does not have a function named PreMenuBar(). What should
I do? Is this a bug?
Thank you.

ShenLei




More information about the wxpython-users mailing list