label change by button tkinter code example
Example 1: Update label text after pressing a button in Tkinter
import tkinter as tk
win = tk.Tk()
def changetext():
a.config(text="changed text!")
a = tk.Label(win, text="hello world")
a.pack()
tk.Button(win, text="Change Label Text", command=changetext).pack()
win.mainloop()
Example 2: label change in tkinter
stud_input=StringVar()
stud_input.set("Label")
lbl3=Label(add_image_frame,textvariable=stud_input,bg="#ED6244",fg="black").grid(row=4,column=0)
stud_input.set("Changed Label")