Tkinter Label Widget
The label is one of the widgets in Tkinter. It is used to display text in the GUI window. An image can also be displayed using the Label widget. Also, a label can contain both text and image simultaneously in the window.
Creating a Label with Text
The syntax to create a Label in Tkinter is given below. Use the option ‘text’ to mention the text that needs to be displayed in the GUI.
label_variablename = tkinter.Label(parent,text="...")
Creating a Label with Image
An image can be added to a label just by converting it to PhotoImage. It requires the PhotoImage class which takes the image file as the argument. Then that image object is passed as the option of the image parameter of the Label widget.
image_variable = tk.PhotoImage(file="image_path")
label_variablename = tkinter.Label(parent,text="...", image=image_variable)
Remove An Image In A Label In Tkinter
Tkinter is a GUI-creating module in Python that is used to create many applications. It has many useful widgets such as Label, Checkbutton, Button, Checkbox, and more. In this article, we will discuss how we can remove an image from the Label widget in Tkinter in Python.