Float editor and validation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Float editor and validation

Fabio Pliger


I have a classe with a Float attribute and I need to avoid the user to input any char ( only "." and "," ). Is it possible?

My class is more or less like this:
actual_value = 10.
uDm = "°C"
class AnalogValueChanger( HasTraits ):
        value = Float( actual_value )
        uDm = Unicode(  unit )
        minimum = Float
        maximum = Float
        new_value = Float
        group = Group(
                        Item('value', style='readonly', label='Actual Value' ),
                        Item('_'),
                        Item('new_value', style='simple', label='New Value'),#, editor = NewValueEditor() ),
                        Item('_'),
                        Item('uDm', style='readonly', label='uDm'),
               )
   
       
        view1 = View( group, title = 'Change Value', buttons = OKCancelButtons )

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev