How to do it...

In Python, we can bind functions to classes by turning them into methods using the self naming convention. This is a truly wonderful capability of Python, and it allows us to create large systems that are understandable and maintainable.

Sometimes, when we only write short scripts, OOP does not make sense because we find ourselves prepending a lot of variables with the self naming convention and the code gets unnecessarily large when it does not need to be.

Let's first create a Python GUI using tkinter and code it in the waterfall style.

The following code GUI_FallDown.py creates the GUI:

#====================== # imports #====================== import tkinter as tk from tkinter import ttk from tkinter import messagebox  ...

Get Python GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.