[Waxgui-users] help with Wax RF
Status: Alpha
Brought to you by:
zephyrfalcon
From: Mike B. <mik...@co...> - 2006-06-24 23:02:13
|
All, I'm new to using Wax and really like the idea of using the waxRf. I've got something sort of how I'd like to see it working with my resource file. My question is: how do I hook up stuff to get my data? Here is a simplified example (probably not the best way to do it -- critiques would be welcome) that has two fields and two buttons. Could someone help me out in how I would define the hooks (whether in the xml or code doesn't matter to me)? Thanks, Mike Following is the code that I have. --------------------------------------------- from wax import * import wax.tools.waxrf as waxrf resource = """\ <?xml version="1.0" ?> <resource> <Panel name="myPanel" > <VerticalPanel name="labels"> <Label text="Location of files" /> <Label text="Report Name" /> </VerticalPanel> <VerticalPanel name="txtCtrls" > <TextBox name="txtLoc" text="d:/myBlogs/Work" _expand="h" /> <TextBox name="txtRptName" text="todosRtp.txt" _expand="h" /> </VerticalPanel> <Button name="btnOK" text="OK" _border="5" /> <Button name="btnCancel" text="Cancel" _border="5" /> </Panel> </resource> """ res = waxrf.XMLResource() res.LoadFromString(resource) # stick a custom event in Button def MyOnClick(self, event): print 'You clicked the button with label', `self.GetLabel()` Button.OnClick = MyOnClick class MainFrame(VerticalFrame): def Body(self): sp1 = res.LoadObject(self, 'myPanel') self.AddComponent(sp1, expand='both') self.Pack() app = Application(MainFrame, title='Test') app.Run() |