我有一个带有 C.create_text
的 tkinter Canvas,由变量确定。
var = "Hello"
C = tk.Canvas(top, width = 1000, height = 500)
p = C.create_text(500, 80, text = var, font = "monaco")
当我按下按钮时,它会更改变量,但我不知道如何更新 Canvas 中的文本
def add():
var = "Hello World"
b = tk.Button(text = "world", command = add)
最佳答案
使用
C.itemconfigure(p, text=var)
关于python - Canvas 文本更新 - Python3 Tkinter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52792254/