December 2000
Intermediate to advanced
816 pages
16h 57m
English
In Example 18.1, we present tkhello1.py, the Tkinter version of “Hello World!” In particular, it shows you how a Tkinter application is set up and highlights the Label widget
|
Our first Tkinter example is… what else? “Hello World!” In particular, we introduce our first widget, the Label.
1 #!/usr/bin/env python
2
3 import Tkinter
4
5 top = Tkinter.Tk()
6 label = Tkinter.Label(top, text='Hello World!')
7 label.pack()
8 Tkinter.mainloop()
|
In the first line, we create our top-level window. That is followed by our Label widget containing the all-too-famous string. We instruct the packer to manage and display our widget, and finally call mainloop() to run ...
Read now
Unlock full access