| the simplest possible Tkinter program |
UserPreferences |
| Tkinter Wiki | FrontPage | RecentChanges | TitleIndex | WordIndex | SiteNavigation | HelpContents | moin.sf.net |
This Tkinter program displays a single label. Clicking the window's "close" decoration makes the program exit:
import Tkinter l = Tkinter.Label(text = "See me?") l.pack() l.mainloop()The last line might not even be necessary if you're using an interactive shell.
Technically, the simplest possible Tkinter program would be one without the label; instead, just:
import Tkinter m = Tkinter.Tk() m.mainloop()
This will just display an empty gray (or other color, depending on your system settings) window with a generic title bar!
Return to Tkinter for beginners.