import tkinter as tk
win = tk.Tk()
win.title("Python GUI") #窗口的标题
win.mainloop()
**增加按钮,显示标签
import tkinter as tk
from tkinter import ttk
def click_me():
a.configure(text = "Hello World")
win = tk.Tk()
win.title("Python GUI") #窗口的标题
a_label = ttk.Label(t,text = "Welcome") #设置一个标签
a_label.grid(column=0,row=0)
button = ttk.Button(win,text = "Click Me!",command = click_me) #增加按钮
button.grid(column = 1, row = 0)
win.mainloop()