I have a tkinter Canvas with a C.create_text
, determined by a variable.
var = "Hello"
C = tk.Canvas(top, width = 1000, height = 500)
p = C.create_text(500, 80, text = var, font = "monaco")
and when I press a button it changes the variable, but I have no idea how to update the text in the canvas
def add():
var = "Hello World"
b = tk.Button(text = "world", command = add)
Use
C.itemconfigure(p, text=var)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With