Implementing our application menu

As a major component of the GUI, our menu is clearly a view, and should be implemented in the views.py file. However, it's also going to need to set options that affect other views (such as the form options we're implementing now) and run functions that affect the application (like quitting). We need to implement it in such a way that we keep controller functions in the Application class but still keep the UI code in views.py. Let's take a look at the following steps:

  1. Let's start out by opening views.py and creating a MainMenu class that subclasses tkinter.Menu:
class MainMenu(tk.Menu):
"""The Application's main menu"""

Our overridden __init__() method will take two dictionaries, a settings dictionary and ...

Get Python GUI Programming with Tkinter 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.