[Tutor] GUI program

Stephanie Quiles stephanie.quiles001 at albright.edu
Tue Jun 30 07:02:23 CEST 2015


Hello, i am attempting to create a GUI program using Python 3.4. please see the pasted code below. Why is nothing showing up? i am using Pycharm to run the program to see what it does and it says there are no errors but it does not show me an output. please let me know where i am falling short on this. 

Thank you 

__author__ = 'stephaniequiles'

""" Write a GUI program that displays your name and address when a button is clicked. when the user clicks the 'show info' button, the
program should display your name and address, as shown in the sketch."""

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,\
                                          tect ='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()



More information about the Tutor mailing list