wxXrcWriter
Rationale
wxPython is a great tool to do cross platform GUI's with a rich set of windows. It has a feature called XRC which
allows you to separate the GUI design from the functional code using XML. However XML is not very easy to write or read.
wxXrcWriter is a library aimed to solve this problem by providing a library which will read and write the XRC format and validate
any change to the layout.
How it works
The principle idea is that it uses an XML definition in order to validate as the data it deals with is object orientated.
XML definition
The are two main types of nodes specified in the xml definition it uses which are class
and param
.
- class node represents a representable wxPython object. In most cases a type of window.
- param node represents a representable parameter of a wxPython object in the XRC file. Eg font, size, position etc
Both these nodes have a name attribute so it can be identified.
The class node has two additional parameters which need to be specified:
- inherits - specifies a comma separated list of class to inherit parameters from or None for don't inherit properties
- hierarchy - specifies where this can occur, either top for this is a top level window or bottom
for this window should have no children or the name of window which it should appear beneath. putting a '-' will have the opposite effect.
There are three type of parameters each denoted by the mode attribute:
- Regular Expression (re) - A parameter best expressed by the regular expression specified
- Option (option) - A parameter best expressed by a combination of the options specified using the option nodes
- Subclass (subclass) - A parameter best expressed by a combination of the three parameters.