Implementing validated widgets in our form
Now that you know how to validate your widgets, you have your work cut out for you! We have 16 input widgets, and you'll have to write code like that shown in the previous section for all of them to get the behavior we need. Along the way, you'll need to make sure the widgets respond consistently to errors and present a consistent API to the application.
If that sounds like something you'd like to put off indefinitely, I can't blame you. Maybe there's a way we can cut down the amount of code we need to write.
Exploiting the power of multiple inheritance
So far, we have learned that Python allows us to create new classes by subclassing, inheriting features from the super class, and only adding or changing what's different about our new class. Python also supports multiple inheritance, where a subclass can inherit from multiple superclasses. We can exploit this feature to our advantage by creating what's called a mixin class.
Mixin classes contain only...