1. Home
  2. Computing & Technology
  3. Python

"Hello, World!" in Python With Tkinter

From , former About.com Guide

9 of 10

The main() Thing

As in the say_hello method of Greeter, we need to create a main frame. We here do that in the main() function. We then use that frame for the instance of Greeter and the rest of the program.

def main():
    root = Tk()
    app = Greeter(master=root)
    app.mainloop()
    root.destroy()

The object of Greeter is called app. The master of that instance is root, the main frame of the program. After instantiating app, we can then call its mainloop method to run the program. Once all is said and done, the last call of the main() function is to destroy the root window.

Explore Python
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python

©2009 About.com, a part of The New York Times Company.

All rights reserved.