[wxPython-users] whoes Validate method to call

Robin Dunn robin at alldunn.com
Mon Feb 19 11:51:03 PST 2007


Christian wrote:
> Hi,
> 
> I'm wondering why I can't just call a control's Validate - if I do so nothing
> happens. Instead I have to call its parent. Is there a good reason for that 
> behaviour? I'm on linux, wxPython 2.8.

Because Validate is intended to be used on a dialog, panel or other 
container widget to make sure that all of it's child widgets pass 
validation.  (IOW, that the whole container is valid.)  So it does a 
"for child in self.GetChildren():..." type of loop.  If you try that on 
a widget that has no children then the loop is effectively empty.

If you need to validate a specific widget then you can do something like 
widget.GetValidator().Validate().


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list