how to update values in tkinter

Solutions on MaxInterview for how to update values in tkinter by the best coders in the world

showing results for - "how to update values in tkinter"
Julian
11 Apr 2017
1import tkinter as tk
2
3win = tk.Tk()
4max_amount = 0
5label1 = None #just so it is defined
6
7def fun():
8    global max_amount, label1
9    max_amount +=100
10    label1.configure(text='Balance :$' + str(max_amount))
11
12btn = tk.Button(win,text = 'Change', command = fun)
13btn.grid()
14t1 =str(max_amount)
15label1 = tk.Label(win,text = 'Balance :$' + t1)
16label1.grid()
17
18win.mainloop()
19