""" another tk practice """ import Tkinter class App: def __init__(self, master): self.frame = Tkinter.Frame(master) self.frame.grid() self.lblOutput = Tkinter.Label(master, text = "type your name") self.lblOutput.grid(row = 0) titles = ["Mr.", "Excellency", "Captain", "Grand Poo-bah"] self.lstTitle = Tkinter.Listbox(master, height = 4) for title in titles: self.lstTitle.insert(Tkinter.END, title) self.lstTitle.grid(row = 1) self.txtInput = Tkinter.Entry(master) self.txtInput.grid(row = 2) self.btnClickMe = Tkinter.Button(master, text = "click me", command = self.sayHi) self.btnClickMe.grid(row = 3) #image not working yet... ball = Tkinter.PhotoImage(file = "ball.gif") self.lblBall = Tkinter.Label(master, image=ball) self.lblBall.grid(row = 4) def sayHi(self): title = self.lstTitle.get(Tkinter.ACTIVE) name = self.txtInput.get() self.lblOutput["text"] = "Hi there, %s %s!" % (title, name) root = Tkinter.Tk() root.title("Hello in Tk") app = App(root) root.mainloop()