Hi all,
I am new to wxPython and am following the example at http://www.serpia.com/page6.php
to save UI layout in xrc and loads it in .py file.
In the example, one has to copy the element names over from
xrc file to py file and load each widget using XRCCTRL. It seems cumbersome to
me if I have to do that manually. It’s going to be difficult to
maintain when I add/remove or even change names of the
widgets in the xrc since I will have to update the .py file correspondingly.
My question is:
Is there any visual design tool that generates both xrc and
the widget initialization part
of the py file? In a way that the changes I make in the designer view will be
reflected in both xrc and py file? For example, MS .Net visual designer
generates both .resx file, which is the resource file and the
InitializeComponent() part of the .cs file, which does control initialization.
Or is there an eaiser way to load xrc resources in Python
code?
TIA for any suggestions.
LS
Liu Shuai wrote:
Hi all,
I am new to wxPython and am following the example at http://www.serpia.com/page6.php to save UI layout in xrc and loads it in .py file.
In the example, one has to copy the element names over from xrc file to py file and load each widget using XRCCTRL. It seems cumbersome to me if I have to do that manually. It’s going to be difficult to
maintain when I add/remove or even change names of the widgets in the xrc since I will have to update the .py file correspondingly.
Actually, you only need to refer to those elements you want to change, access their values, hook events to, etc. I can give you a code sample if you like, from a small app that I'm building.
My question is:
Is there any visual design tool that generates both xrc and the widget **initialization** part of the py file? In a way that the changes I make in the designer view will be reflected in both xrc and py file? For example, MS .Net visual designer generates both .resx file, which is the resource file and the InitializeComponent() part of the .cs file, which does control initialization.
Not that I know of, although an XSLT genius could probably cobble up something that would generate .py code directly from the XRC. Alternately, you can try wxGlade at http://wxglade.sourceforge.net/, which can generate Python, C++ and XRC. I tried it for a bit, but found it too flaky at the time (it always crashed when I tried to delete an element).
Happy hunting,
Don Dwiggins