Skip to Content
Python GUI Programming with Tkinter
book

Python GUI Programming with Tkinter

by Alan D. Moore
May 2018
Beginner to intermediate content levelBeginner to intermediate
452 pages
11h 26m
English
Packt Publishing
Content preview from Python GUI Programming with Tkinter

Creating the application file

Finally, let's create our controller class, Application, by following these steps:

  1. Open the application.py file and copy in the Application class definition from the script.

 

  1. The first thing we'll fix is our imports. At the top of the file, add the following code:
import tkinter as tk
from tkinter import ttk
from datetime import datetime
from . import views as v
from . import models as m

We need tkinter and ttk, of course, and datetime to define our filename. Although we only need one class each from views and models, we're going to keep them in their own namespaces anyway. It's likely we're going to have many more views as the application expands, and possibly more models.

  1. We need to update the call to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python GUI Programming with Tkinter - Second Edition

Python GUI Programming with Tkinter - Second Edition

Alan D. Moore

Publisher Resources

ISBN: 9781788835886Supplemental Content