Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to update values in tkinter

import tkinter as tk

win = tk.Tk()
max_amount = 0
label1 = None #just so it is defined

def fun():
    global max_amount, label1
    max_amount +=100
    label1.configure(text='Balance :$' + str(max_amount))

btn = tk.Button(win,text = 'Change', command = fun)
btn.grid()
t1 =str(max_amount)
label1 = tk.Label(win,text = 'Balance :$' + t1)
label1.grid()

win.mainloop()
Comment

how to update values in tkinter

import tkinter as tk

win = tk.Tk()
max_amount = 0
label1 = None #just so it is defined

def fun():
    global max_amount, label1
    max_amount +=100
    label1.configure(text='Balance :$' + str(max_amount))

btn = tk.Button(win,text = 'Change', command = fun)
btn.grid()
t1 =str(max_amount)
label1 = tk.Label(win,text = 'Balance :$' + t1)
label1.grid()

win.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: compare two datetime in python 
Python :: break in python 
Python :: multiline comment in python 
Python :: numpy randn with a shape of another array 
Python :: dict to attr python 
Python :: python node class 
Python :: python if statement 
Python :: pandas find all rows not null 
Python :: np.r_ 
Python :: kivy dropdown list 
Python :: BURGERS2 
Python :: serialize keras model 
Python :: drop row with duplicate value 
Python :: how to open folder in python 
Python :: how to detect the reaction to a message discord.py 
Python :: plt.hist using bins 
Python :: python print emoji 
Python :: Could not find a version that satisfies the requirement ckeditor 
Python :: python to make video 
Python :: python ord() 
Python :: mapping with geopandas 
Python :: argmax implementation 
Python :: Python Frozenset() for Dictionary 
Python :: input function in python 
Python :: labelencoder update 
Python :: bitwise operators python 
Python :: specific mail.search python UNSEEN SINCE T 
Python :: check for string in list python 
Python :: spanish to english 
Python :: python for web development 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =