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
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)



Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images









