"""Fun with a label, a text entry field, a button, and a callback.""" from Tkinter import * class App: def __init__(self, parent): self.parent = parent self.create_widgets() def create_widgets(self): self.label1 = Label( self.parent, text="Hello world") self.label1.pack() self.entry1 = Entry(self.parent) self.entry1.pack() self.button1 = Button( self.parent, text="Change it", command=self.do_it) self.button1.pack() def do_it(self): message = self.entry1.get() self.label1.config(text=message) # Boilerplate from here on... if __name__ == '__main__': root = Tk() app = App(root) root.mainloop()