Adding the menu functionality in the controller

Now that our menu class is defined, our Application object needs to create an instance and add it into the main window. Before we can do that, we'll need to define some things that our MainMenu class needs.

Remember the following things from the previous section:

  • We need a settings dictionary that contains Tkinter variables for our two settings options
  • We need a callbacks dictionary that points to callbacks for file->select and file->quit
  • We need the actual functions that implement file selection and quitting

Let's define some things that our MainMenu class needs.

Open application.py and let's start adding code just before the creation of self.recordform:

    self.settings = { 'autofill date': ...

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.