Hello, I am practicing code in my Python book and I am struggling to define the submit and clear buttons for this Address Entry Form. It isn't working and states that they aren't defined. I also cannot get the 'sunken' effect look on the window frame. Can you help? My code is below.   # Import tkinter import tkinter as tk # Define the submit button with a function def submit():     print("First Name: %s\nLast Name: %s\nAddress Line 1: %s\nAddress Line 2: %s\nCity: %s\nState/Province: %s\nCountry: %s" % (e1.get(), e2.get(), e3.get(), e4.get(), e5.get(), e6.get(), e7.get())) # Define the clear button with a function def clear():     e1.delete(0, 'end')     e2.delete(0, 'end')     e3.delete(0, 'end')     e4.delete(0, 'end')     e5.delete(0, 'end')     e6.delete(0, 'end')     e7.delete(0, 'end') # Create the master title master = tk.Tk() master.title("Address Entry Form") # Create the 'sunken' look for the window frame sunken_frame = tk.Frame(master, relief=tk.SUNKEN) # Create the labels labels=["First Name", "Last Name", "Address Line 2", "City", "State/Province", "Country"] entries = [] # Create the length for the labels for i in range(len(labels)):     tk.Label(master, text=labels[i]).grid(row=i)     entries.append(tk.Entry(master))     entries[i].grid(row=i, column=1) # Create the submit button tk.Button(master, text='Submit', command=submit).grid(row=len(labels), column=1, sticky=tk.W, pady=4) # Create the clear button tk.Button(master,text='Clear', command=clear).grid(row=len(labels), column=0, sticky=tk.W, pady=4) # Run the program tk.mainloop()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hello, I am practicing code in my Python book and I am struggling to define the submit and clear buttons for this Address Entry Form. It isn't working and states that they aren't defined. I also cannot get the 'sunken' effect look on the window frame. Can you help? My code is below.

 

# Import tkinter

import tkinter as tk

# Define the submit button with a function

def submit():
    print("First Name: %s\nLast Name: %s\nAddress Line 1: %s\nAddress Line 2: %s\nCity: %s\nState/Province: %s\nCountry: %s" % (e1.get(), e2.get(), e3.get(), e4.get(), e5.get(), e6.get(), e7.get()))

# Define the clear button with a function

def clear():
    e1.delete(0, 'end')
    e2.delete(0, 'end')
    e3.delete(0, 'end')
    e4.delete(0, 'end')
    e5.delete(0, 'end')
    e6.delete(0, 'end')
    e7.delete(0, 'end')

# Create the master title

master = tk.Tk()
master.title("Address Entry Form")

# Create the 'sunken' look for the window frame

sunken_frame = tk.Frame(master, relief=tk.SUNKEN)

# Create the labels

labels=["First Name", "Last Name", "Address Line 2", "City", "State/Province", "Country"]
entries = []

# Create the length for the labels

for i in range(len(labels)):
    tk.Label(master, text=labels[i]).grid(row=i)
    entries.append(tk.Entry(master))
    entries[i].grid(row=i, column=1)

# Create the submit button

tk.Button(master, text='Submit', command=submit).grid(row=len(labels), column=1, sticky=tk.W, pady=4)

# Create the clear button

tk.Button(master,text='Clear', command=clear).grid(row=len(labels), column=0, sticky=tk.W, pady=4)

# Run the program

tk.mainloop()

der-
hen
pri-
use any geometry manager you like.
Address Entry Form
First Name:
Last Name:
Address Line 1:
Address Line 2:
City:
State/Province:
Postal Code:
Country:
Clear
X
Submit
Transcribed Image Text:der- hen pri- use any geometry manager you like. Address Entry Form First Name: Last Name: Address Line 1: Address Line 2: City: State/Province: Postal Code: Country: Clear X Submit
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Unary Predicate
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education