Page 299 -
P. 299
create the interface
Code Magnets
Complete the code to create the interface. Think carefully about the
widgets you will need for each of the fields.
from tkinter import *
Create the GUI.
app = Tk()
You don't need Recall that “pack()” adds
app.title('Head-Ex Deliveries')
to keep track of Label(app, text = "Depot:").pack() the widgets to the window.
the labels, so no
need to assign
depot = Entry(app) You'll want to keep track Calling “pack()” without options
them to variables.
depot.pack() of the data entry fields, so means you leave it to tkinter
assign them to variables. to decide how best to lay
things out on the GUI.
This means the button
Button(app, text = "Save", command = save_data).pack() will call the save_data()
function when it's clicked.
Entry(app)
Label(app, text = "Description:") Text(app) description =
description
.pack() .pack() address
.pack()
.pack() address =
Label(app, text = "Address:")
app.mainloop()
264 Chapter 8