[wxPython] Validator for TxtCtrl to trigger with a custom Button handler

Lo?c Mah? loic.mahe at free.fr
Thu Jul 22 04:11:47 EDT 2004


Your solution does not seem work, at least on my system!
Does it works on your system ?

I got a message telling me that:

_myTextCtrl / self.tc has no Validate attribute


I have:
windows
python 2.3.4
wxpython 2.5.1


I finnaly got a kind of ugly workaround to call the Validate() function:

I had to replace:
if self.Validate():

by:
if self.tc.GetValidator().Validate(self.tc):

I find this quite ugly and not pythoninc at all,
but this is the only solution I found yet!

Loic


"F. GEIGER" <franz.geiger at fh-vorarlberg.ac.at> wrote in message news:<40fe5226$0$17706$3b214f66 at aconews.univie.ac.at>...
> def _onButton_(self, event):
>    success = self._myTextCtrl.Validate()
>    return
> 
> self is the Frame here. _onButton_ therefore belongs to the frame and was
> bound with wx.Button.Bind.
> 
> HTH
> F. GEIGER
>



More information about the Python-list mailing list