[wxPython-users] Re: PyValidator and floats, howto?

Werner F. Bruhin werner.bruhin at free.fr
Sat Jan 20 04:46:36 PST 2007


Hi Basil,

Basil Shubin wrote:
> Hi Werner,
>
> Werner F. Bruhin wrote:
>> Hi Basil,
>>
>> Basil Shubin wrote:
>>> Werner F. Bruhin wrote:
>>>> Hi Basil,
>>>>
>>>> I don't want to insist, but why don't you used just the 
>>>> wx.lib.masked.numctrl or wx.lib.masked.textctrl with an appropriate 
>>>> mask?
>>>
>>> Thank for suggestion, but I don't like very much masked controls 
>>> behavior. It's looks very good for phone number, but for floats... 
>>> First, is dot sign - I have it!
>> I am not sure I understand, do you want a ',' instead of '.'?  If 
>> yes, look at DecimalChar and GroupChar property.
>
> The sign itself, no matter if it's a ',' or '.' The problem is, that 
> user must have way to input fraction part of float, or just enter only 
> integer. But if he input '.', than he can only input two digits after 
> that.
One can enter as many digits after the '.' as the control is defined 
for, just did it with 5 digits, one can enter fewer then defined by the 
control but not more.
>
>>> Second, is that I can move input cursor forward and back, while 
>>> field is empty.
>> I don't know if this can be changed.  I most set SelectOnEntry to 
>> True, so when you move into the control you can then type the value.
>
> Alas, my question stays unanswered, but if there is no solution for 
> PyValidator, the masked control is my last chance.
Maybe you find your answer with the masked controls, as they do 
validation.   I assume you know about the wxPython validator demo under 
Core Windows/Controls.

Maybe posting a small runnable sample will get some people to review and 
suggest changes.

Werner





More information about the wxpython-users mailing list