pythonware.com | products ::: library ::: search ::: daily Python-URL! |
Hello, TkinterChapter 2. Hello, Tkinter
But enough talk. Time to look at some code instead. As you know, every serious tutorial should start with a "hello world"-type example. In this overview, we'll show you not only one such example, but two. First, let's look at a pretty minimal version: Example 2-1. Our First Tkinter Program # File: hello1.py from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() Running the ExampleTo run the program, run the script as usual: $ python hello1.py The following window appears. Figure 2-1. Running the program To stop the program, just close the window. |