While using PyQt5, there occur a need of removing or clearing labels in order to do so
clear() method is used. This method belongs to the QLabel class, and can be used on only label widgets.
Syntax : label.clear()
Argument : It takes no argument.
Action Performed : It clears(remove) the label from main window.
Below is the implementation of this method.
As on the above image we can see Label2 will not be seen because of
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 clear the content of label | clear and setText method
- clear() element method - Selenium Python
- set clear() in python
- Python Dictionary clear()
- How to clear screen in python?
- Different ways to clear a list in Python
- Matplotlib.axes.Axes.clear() in Python
- Matplotlib.figure.Figure.clear() in Python
- Clear LRU Cache in Python
- Python - turtle.clear()
- PyQt5 – How to hide label | label.setHidden method
- PyQt5 - lower() method for Labels
- setGeometry method - Pyqt5
- setToolTip method in PyQt5
- move() method in PyQt5
- PyQt5 – How to change text of pre-existing label | setText method
- PyQt5 – How to change size of the Label | label.resize method
- deleteLater() method in PyQt5
- close() method in PyQt5
- Set Window Icon Text in PyQt5 | setWindowIconText() 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 email@example.com. 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.