can i define a new method at runtime?

Ville Vainio ville at spammers.com
Sat Jun 19 23:32:44 CEST 2004


>>>>> "Raoul" == Raoul  <raoulsam at yahoo.com> writes:

    Raoul> I have a GUI application where I want to assign validation
    Raoul> methods to controls.

    Raoul> If my control myTextBox has a change() event for on change
    Raoul> and I want to make it verify the input is an integer I
    Raoul> could do...

If there is a change method, I assume you need to implement the class
yourself. Why not just subclass the root TextBox class and create a
IntegerTextBox class that has verifyInteger in the change method? Then
you just choose at instantiation time that this particular textbox
needs an integer...

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list