tkinter label textvariable example

var = StringVar()
var.set('hello')

l = Label(root, textvariable = var)
l.pack()

Here is what the above code is Doing:
1. We create a StringVar object.
2. We set the value of the StringVar object to ‘hello’.
3. We create a Label widget, and we tell it to display the value of the StringVar object.
4. We pack the Label widget.