To display the text and images in an application window, we generally use the Tkinter Label widget. In this example, we will update the Label information by defining a variable. Whenever the information stored in the variable changes, it will update the Label as well. We can change the Label information while defining the textvariable property in the Label widget.
#Import the required library from tkinter import * #Create an instance of tkinter frame win = Tk() win.geometry("750x250") #Create a String Object and set the default value var = StringVar() #Create a text label label = Label(win, textvariable = var, font=('Helvetica 20 italic')) label.pack() #Create an entry widget to change the variable value text = Entry(win, textvariable = var) text.pack() win.mainloop()
Running the above code will display a window with an entry widget and a Label. The Label gets updated whenever we enter some text in the Text Field.