Programming Exercises 1. Name and Address Write a GUI program that displays your name and address when a button is clicked. The program's window should appear as the sketch on the left side of Figure 13-61 when it runs. When the user clicks the Show Info button, the program should display your name and address, as shown in the sketch on the right of the figure. re 13-61 Name and address program Show Info Quit Steven Marcus 274 Baily Drive Waynesville, NC 27999 Show Info Quit

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

Can someone help me solve this program? The only result shown is the empty window. 

Below is the codes I have: 

import tkinter as tk

import tkinter.messagebox

 

def myWindow: 

def --unit--(self): 

self.main_window = tkinter.Tk()

#This is a button for show info 

#When the user clicks the show info button

# The name and address should be displayed 

self.my_button = tkinter.Button(self.main_window, text = 'Click', command = self.do_something) 

 

#quit-button. When the user clicks on it, 

# the info should be deleted or closed

self.quit_button = tkinter.Button('Response', text = 'Quit', command = self.main_window.destroy)

 

#pack the button 

self.my_button.pack()

self.quit_button.pack()

 

#manin loop

tkinter.mainloop()

 

#enter the do something callback function for the button widget

def do_something(): 

#display info dialog box

tkinter.message box.showinfo('Response', Name and Address comes here') 

 

window =tk.Tk()

window.title(My Adrress) 

window.mainloop()

 

if --name-- == '--main--':

my-window = myWindow()

 

Chp12: GUI

Python: Fifth Edition (Tony GaDDis) 

 

 

d
em
Programming Exercises
1. Name and Address
Write a GUI program that displays your name and address when a button is clicked. The
program's window should appear as the sketch on the left side of Figure 13-61 when it
runs. When the user clicks the Show Info button, the program should display your name
and address, as shown in the sketch on the right of the figure.
igure 13-61 Name and address program
Show Info
Quit
Steven Marcus
274 Baily Drive
Waynesville, NC 27999
Show Info
Quit
Transcribed Image Text:d em Programming Exercises 1. Name and Address Write a GUI program that displays your name and address when a button is clicked. The program's window should appear as the sketch on the left side of Figure 13-61 when it runs. When the user clicks the Show Info button, the program should display your name and address, as shown in the sketch on the right of the figure. igure 13-61 Name and address program Show Info Quit Steven Marcus 274 Baily Drive Waynesville, NC 27999 Show Info Quit
ain.py - Lab12_GUI - Replit X +
replit.com/@katy21/Lab12GUI#main.py
012_GUI
y21
al
=t
+o
68
1
Help
3
Threads
Storage
8
9
⠀ 10
11
12 #def main():
13 ▼ class myGUI:
14
15
16▼
17
18
19
20
21
22
23
24
Debugger
8
main.py x +
X
25
26
27
28
29
30
31
32
33
import tkinter as tk
import tkinter.messagebox
#create main window widget
def __unit__(self):
self.main_window = tkinter.Tk()
#Create a button widget. The text "Click"
#do_somthing method should be executed
#when the user clicks the button
#
▶ Run
self.my_button = tkinter.Button self.main_window, \
self.do_something)
text = 'Click', command =
#Quit_button. When the button is clicked
#The root widget's destroy method is called
#(The main_window variable references the root widget,
# so the callback function is self.main_window.destroy.)
self.quit_button = tkinter. Button('Response',
text = 'Quit', command =
self.main_window.destroy)
Transcribed Image Text:ain.py - Lab12_GUI - Replit X + replit.com/@katy21/Lab12GUI#main.py 012_GUI y21 al =t +o 68 1 Help 3 Threads Storage 8 9 ⠀ 10 11 12 #def main(): 13 ▼ class myGUI: 14 15 16▼ 17 18 19 20 21 22 23 24 Debugger 8 main.py x + X 25 26 27 28 29 30 31 32 33 import tkinter as tk import tkinter.messagebox #create main window widget def __unit__(self): self.main_window = tkinter.Tk() #Create a button widget. The text "Click" #do_somthing method should be executed #when the user clicks the button # ▶ Run self.my_button = tkinter.Button self.main_window, \ self.do_something) text = 'Click', command = #Quit_button. When the button is clicked #The root widget's destroy method is called #(The main_window variable references the root widget, # so the callback function is self.main_window.destroy.) self.quit_button = tkinter. Button('Response', text = 'Quit', command = self.main_window.destroy)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Running Time of Application
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
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