# An object oriented approach to creating GUI's import Tkinter class GUI: def __init__(self): # Create a TK root widget self.main_window = Tkinter.Tk() # Create a Label widget containing the # text 'Hello World!' # More options: # http://www.pythonware.com/library/tkinter/introduction/x5258-options.htm # # Notice that we pass the main_window self.label = Tkinter.Label(self.main_window, text="Hello world") # Call the Label widget's pack method self.label.pack() # Enter the Tkinter main loop, this will cause the window # to be rendered to the screen. self.main_window.mainloop() def main(): window = GUI() main()