# Author:Richard
from tkinter import *
def processOK():
print("OK button is clicked!")
def processCancel():
print("Cancel button is clicked!")
window = Tk() #creat a window
# label = Label(window, text = "Welcome to Python!") #小构建类
# button = Button(window, text = "Click Me")
# label.pack() #place the label in the window
# button.pack() #pack包管理器将小构建一行一行放在窗口中
btOK = Button(window, text = "OK", fg = "red", command = processOK) #回调函数或处理器
btCancel = Button(window, text = "Cancel", fg = "yellow", command = processCancel)
btOK.pack()
btCancel.pack()
window.mainloop() #creat an event loop实践循环