Setting up a broad GUI structure

Let's now set up the broad GUI elements of our program. We will create a PaintApplication class in 6.01.py. Since we want to draw the menu using our framework, we import the framework into our file and inherit from the Framework class as follows:

import frameworkclass PaintApplication(framework.Framework):    def __init__(self, root):    super().__init__(root)    self.create_gui()

The __init__ method calls another method, create_gui, which is responsible for creating the basic GUI structure for our program.

The create_gui method simply delegates the task to five separate methods, each being responsible for creating one section of the GUI as follows (see code 6.01.py):

def create_gui(self):  self.create_menu() self.create_top_bar() ...

Get Tkinter GUI Application Development Blueprints - 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.