[wxPython-users] Enumerating XML resource names
Robin Dunn
robin at alldunn.com
Thu Jun 1 12:06:18 PDT 2006
Hubbard, Gary wrote:
> Hi,
>
> I am just starting out trying to use xrced, rather than constructing
> frames and dialog boxes directly in the __init__ method.
>
> I find it awkward to need code like
> dlg.Item = xrc.XRCCTRL(dlg,'Item')
> to all accessing the values with
> dlg.Item.SetValue(…)
> before showing the dialog box.
>
> Is there a way to get all the resource names, so that could be done
> automatically?
Take a look at the new pywxrc tool in CVS.
http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/wx/tools/pywxrc.py
It now generates a Python module with a base class for each top-level
item in the XRC that loads itself from the resource and also has code
like "self.Item = xrc.XRCCTRL(self,'Item')" for every named item.
> I looked through the source first, and don't see any way to walk the
> resource nodes.
Any XML parser can do it. That's all that pywxrc uses.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list