Book Image

Python GUI Programming Cookbook

By : Burkhard Meier
Book Image

Python GUI Programming Cookbook

By: Burkhard Meier

Overview of this book

Table of Contents (18 chapters)
Python GUI Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mixing fall-down and OOP coding


Python is an object-oriented programming language yet it does not always make sense to use OOP. For simple scripting tasks, the legacy waterfall coding style is still appropriate.

In this recipe, we will create a new GUI that mixes both the fall-down coding style with the more modern OOP coding style.

We will create an OOP-style class that will display a tooltip when we hover the mouse over a widget in a Python GUI that we will create using a waterfall style.

Note

Fall-down and waterfall coding styles are the same. It means that we have to physically place code above code before we can call it from the code below. In this paradigm, the code literally falls down from the top of our program to the bottom of our program when we execute the code.

Getting ready

In this recipe, we will create a GUI using tkinter, which is similar to the GUI we created in the first chapter of this book.

How to do it...

In Python, we can bind functions to classes by turning them into methods...