[wxPython-users] Re: Custom validator

Werner F. Bruhin werner.bruhin at free.fr
Tue Jan 2 09:00:49 PST 2007


Hi Basil,

I would do this:
        self.alcohol = 
wx.lib.masked.numctrl.NumCtrl(id=wxID_VINTAGEDETAILALCOHOL,
              name='alcohol', parent=self, pos=wx.Point(137, 23),
              size=wx.Size(36, 22), style=0, value=0)
        self.alcohol.SetAllowNegative(False)
        self.alcohol.SetGroupDigits(False)
        self.alcohol.SetIntegerWidth(2)
        self.alcohol.SetFractionWidth(1)

I.e. I would just use the wx.lib.masked controls ;-) , or if you need to 
implement this but don't want to use them then you might find some hints 
on how Will Sadkin did it in these controls.

Werner

Basil Shubin wrote:
> Hi,
>
> Phil Mayes пишет:
>>
>> Try:
>> FLOAT = r'\d+\.\d+$'
>
> Not exactly what it should be. The problem is that I want check all 
> input char and 'allow' only digits, but all digits should fit the 
> regex pattern. For checking where is pressed key correspond the 
> digits, is to bind on wx.EVT_CHAR and than check if key is digit (it's 
> showed in wxPython validator example). But I don't know how I can 
> check the entire inputed string, so it fits regex pattern.
>






More information about the wxpython-users mailing list