# File: hello2.py from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() button = Button(frame, text="QUIT", fg="red", command=frame.quit) button.pack(side=LEFT) hi_there = Button(frame, text="Hello", command=self.say_hi) hi_there.pack(side=LEFT) self.clickme = Button(frame, text="Clickme", command=self.click_me) self.clickme.pack(side=LEFT) def say_hi(self): print "hi there, everyone!" def click_me(self): print "clikeyclikey" root = Tk() app = App(root) root.mainloop()