label.set tkinter code example

Example 1: python tkinter label

from Tkinter import *

root = Tk()

w = Label(root, text="Hello Tkinter!")
w.pack()

root.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")

Example 3: tkinter label

from Tkinter import *

root = Tk()
var = StringVar()
label = Label( root, textvariable=var, relief=RAISED )

var.set("Hey!? How are you doing?")
label.pack()
root.mainloop()