+ 1

Can anyone help me to debug this? I think that the bottoms should show up first, then display the name and the 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 the following figure 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. import tkinter class AddressGUI: def __init__(self): self.main_window = tkinter.Tk() self.top_frame= tkinter.Frame() self.mid_frame= tkinter.Frame() self.bottom_frame = tkinter.Frame() self.name_label= tkinter.Label(self.top_frame,\ text='Steven Marcus') self.name_label.pack(side='left') self.value = tkinter.StringVar() self.address_label = tkinter.Label(self.mid_frame,\ text='274 Baily Drive Waynesville, NC 27999') self.address_label.pack(side='left') self.show_button = tkinter.Button(self.bottom_frame,\ text="show info",\ command=self.showinfo) self.quit_button = tkinter.Button(self.bottom_frame,\ text ='Quit',\ command=self.main_window.destroy) self.show_button.pack(side='left') self.quit_button.pack(side='left') self.top_frame.pack() self.mid_frame.pack() self.bottom_frame.pack() tkinter.mainloop() def showinfo(self): name = 'Steven Marcus' address = '274 Baily Drive Waynesville, NC 27999' info = name + address allinfo = AddressGUI() addressGUI = AddressGUI() This is my code of this, but I think that there are some errors. How can I made the bottom shows out, then the name and address would be display?

1st Jun 2019, 9:41 AM
方羿婷
方羿婷 - avatar
5 ответов
+ 3
I suppose your teacher gave you this as an assignment? We can't do it for you, only correct you after you show us your own attempt. (Use tkinter, it is easy to use and to find simple explanations online about.)
1st Jun 2019, 9:52 AM
HonFu
HonFu - avatar
+ 2
What's wrong? What error or bug you get?
1st Jun 2019, 10:20 AM
HonFu
HonFu - avatar
+ 1
import tkinter class AddressGUI: def __init__(self): self.main_window = tkinter.Tk() self.top_frame= tkinter.Frame() self.mid_frame= tkinter.Frame() self.bottom_frame = tkinter.Frame() self.name_label= tkinter.Label(self.top_frame,\ text='Steven Marcus') self.name_label.pack(side='left') self.value = tkinter.StringVar() self.address_label = tkinter.Label(self.mid_frame,\ text='274 Baily Drive Waynesville, NC 27999') self.address_label.pack(side='left') self.show_button = tkinter.Button(self.bottom_frame,\ text="show info",\ command=self.showinfo) self.quit_button = tkinter.Button(self.bottom_frame,\ text ='Quit',\ command=self.main_window.destroy) self.show_button.pack(side='left') self.quit_button.pack(side='left') self.top_frame.pack() self.mid_frame.pack() self.bottom_frame.pack() tkinter.mainloop() def showinfo(self): name = 'Steven Marcus' address = '274 Baily Drive Waynesville, NC 27999' info = name + address allinfo = AddressGUI() addressGUI = AddressGUI() This is my code of this, but I think that there are some errors. How can I made the bottom shows out, then the name and address would be display?
1st Jun 2019, 10:18 AM
方羿婷
方羿婷 - avatar
0
You should use Tkinter. There are plenty tutorials of it on the internet
1st Jun 2019, 9:52 AM
Trigger
Trigger - avatar
0
I’m not sure that is correct or not. Cause the code I wrote shows out the bottoms and the strings at the same time.
1st Jun 2019, 2:08 PM
方羿婷
方羿婷 - avatar