📜  在 Tkinter 中按下按钮后更新标签文本 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:13.207000             🧑  作者: Mango

代码示例1
#tested and working on PYTHON 3.8 AND ADDED TO PATH
import tkinter as tk
win = tk.Tk()

def changetext():
    a.config(text="changed text!")
    
a = tk.Label(win, text="hello world")
a.pack()
tk.Button(win, text="Change Label Text", command=changetext).pack()

win.mainloop()