Aug-07-2017, 04:28 PM
the way you are doing the StringVar is correct. I suspect it is due to your root.after() condition?
import tkinter as tk import random root = tk.Tk() L = tk.Label(root, justify = 'left') L.pack() V = tk.StringVar() L['textvariable'] = V V.set('Test') def set_lbl(): V.set(str(random.randint(0,100))) btn = tk.Button(root, text='change', command=set_lbl).pack() root.mainloop()
Recommended Tutorials: