CHAPTER 9
GUI PROGRAMMING USING TKINTER
9.1 Introduction
Tkinter (读作 T-K-Inter 是Tk interface的缩略),是Python自带的GUI库。
-----------------------------------------------------------------------------
9.2 Getting Started with Tkinter
LISTING 9.1 SimpleGUI.py
from tkinter import * # Import all definitions from tkinter
window = Tk() # Create a window
label = Label(window, text = "Welcome to Python") # Create a label
button = Button(window, text = "Click Me") # Create a button
label.pack() # Place the label in the window
button.pack() # Place the button in the window
window.mainloop() # Create an event loop
------------------------------------------------------------------------------
9.3 Processing Events
LISTING 9.3