Prerequisites: Introduction to tkinter
Tkinter is a standard GUI (Graphical user interface) package for python. It provides a fast and easy way of creating a GUI application.
To create a tkinter application:
- Importing the module — tkinter
- Create the main window (container)
- Add any number of widgets to the main window.
- Apply the event Trigger on the widgets.
Widgets are the controlling tools for any GUI application. Here widget’s main role is to provide a good variety of control. Some widgets are buttons, labels, text boxes, and many more.
One of its widgets is the label, which is responsible for implementing a display box-section for text and images. Click here For knowing more about the Tkinter label widget.
Now, let’ see how To change the text of the label:
Method 1: Using Label.config() method.
Parameter: text– The text to display in the label.
This method is used for performing an overwriting over label widget.
Method 2: Using StringVar() class.
Return: String variable object
This class is used the for setting the values and changing it according to the requirements.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- PyQt5 – How to change size of the Label | label.resize method
- PyQt5 Scrollable Label - Getting tool tip text of the label part
- PyQt5 – How to change text of pre-existing label | setText method
- PyQt5 – How to change font and size of Label text ?
- Change the color of certain words in the tkinter text widget
- PyQt5 – How to hide label | label.setHidden method
- PyQt5 Scrollable Label - Setting tool tip to the label part
- PyQt5 Scrollable Label – Setting tool tip duration to label part
- PyQt5 Scrollable Label – Getting tool tip duration of the label part
- PyQt5 Label – Checking if label is window type
- PyQt5 Label – Checking if label is widget type
- Python Tkinter - Label
- PyQt5 – How to change color of the label ?
- PyQt5 – Change background color of Label for anti hover state
- wxPython - Change Button Label Font
- Change the size of MessageBox - Tkinter
- Change Icon for Tkinter MessageBox
- Change the position of MessageBox - Tkinter
- PyQt5 – How to align Text of Label
- PyQt5 – What's this help text for Label | setWhatsThis() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.