How to create Label widget in PyQt5 ?
While designing any GUI (Graphical User Interface) there is a need to display plain text on screen, in order to do so Label widget is used in PyQt5.
A label is a graphical control element which displays text on a form. It is usually a static control; having no interactivity. A label is generally used to identify a nearby text box or other widget. Some labels can respond to events such as mouse clicks, allowing the text of the label to be copied, but this is not standard user-interface practice.
To use Labels in PyQt5 we have to import
PyQt5.QtWidgets , below is the syntax to do so.
from PyQt5.QtWidgets import QLabel
Qlabel, we can create Labels in our PyQt5 application.
self.label_name = QLabel(Info, self)
Info can be any text of string type.
Below is the Python implementation –