XRCed: Most simple example won't work, what am I doing wrong?
Markus Schöpflin
markus.schoepflin at comsoft.de
Thu May 10 04:01:26 PDT 2007
Hello,
I'm using XRCed 0.1.8-5 from the wxPython 2.8.3 doc and demos installation.
I have created a small xrc file:
---%<---
<?xml version="1.0" encoding="cp1252"?>
<resource>
<object class="wxFrame" name="FRAME1">
<title></title>
<object class="wxMenuBar">
<object class="wxMenu" name="MENU_FILE">
<label>&File</label>
<object class="wxMenuItem" name="COMMAND_QUIT">
<label>&Quit</label>
</object>
</object>
</object>
</object>
</resource>
--->%---
I tell XRCed to generate the Python code for me, resulting in the following class:
---%<---
class xrcFRAME1(wx.Frame):
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.PreFrame()
self.PreCreate(pre)
get_resources().LoadOnFrame(pre, parent, "FRAME1")
self.PostCreate(pre)
# Define variables for the controls
self.MENU_FILE = xrc.XRCCTRL(self, "MENU_FILE")
self.COMMAND_QUIT = self.FindItemById(xrc.XRCID("COMMAND_QUIT"))
--->%---
When trying to instantiate this class, I get the following error:
---%<---
...
self.COMMAND_QUIT = self.FindItemById(xrc.XRCID("COMMAND_QUIT"))
AttributeError: 'xrcFRAME1' object has no attribute 'FindItemById'
--->%---
Now, could anybody please tell me what I am doing wrong?
TIA, Markus
More information about the wxpython-users
mailing list