Using validators to manage data in a dialog

A validator is a special wxPython object that simplifies managing data in a dialog. When we discussed events in chapter 3, we mentioned briefly that if a widget has a validator, the validator can be automatically invoked by the event system. We've also seen validator as a parameter in the constructor of several of the wxPython widget classes, but we haven't yet discussed them. The validator has three unrelated functions:

■ Validates the data in the control before the dialog closes

■ Automatically transfers data to and from the dialog

■ Validates the data as the user types

Was this article helpful?

0 0

Post a comment