Using classes with Tkinter
GUI frameworks and object-oriented code go hand in hand. While Tkinter, more than most frameworks, allows you to create GUIs using procedural programming, we miss out on a great deal of organizational power in doing so. Although we'll find many ways to use classes in our Tkinter code throughout this book, we'll look at three primary ways of using them here:
- Improving or expanding Tkinter classes for more power
- Creating compound widgets to save repetitive typing
- Organizing our application into self-contained components
Improving Tkinter classes
Let's face it: some Tkinter objects are a little lacking in functionality. We can fix that by subclassing Tkinter classes and making our own improved versions. For instance, while we've seen that Tkinter control variable classes are useful, hey are limited to string, integer, double, and Boolean types. What if we wanted the functionality of these variables, but...