wxPython: How to get a child by name?

Franz GEIGER fgeiger at datec.at
Tue Mar 27 21:21:22 CEST 2001

I currently try to polish some of my apps with a GUI and decided to go for

I use wxDesigner for the layout. As it generates code after every change, I
named all the text controls and checkboxes etc. of the dialog hosting all
those controls by applying SetName() to the controls. The Dialog is small,
so I do not use validators yet.

To get a text control of the dialog I thought I could write
theValue = self.FindWindowByName("tcSurname").GetValue().
This raises an exception, because the return value is of type wxWindowPtr
which does not have such a method.

After a while I found a method which worked, at least for text controls:

But for checkboxes GetLabel() returns the button's text and not the boolean
value checked/unchecked. This were returned by GetValue(), but GetValue()
... (see above).

For a "quick" hack in a MSVC project I would downcast the returned pointer
of GetDlgCtrl() to be able to call the subclassed object's methods. But how
do I proceed here?

Any hints greatly welcome.

Best regards

More information about the Python-list mailing list