pyqt4 Basic Widgets : QLabel


QLabel is used for displaying text or an image. No user interaction functionality is provided. The visual appearance of the label can be configured in various ways, and it can be used for specifying a focus mnemonic key for another widget.


A QLabel object acts as a placeholder to display non-editable text,image, or a animated GIF. It can also be used as a mnemonic key for other widgets.

In this example, QLabel objects l2 and l4 have the caption containing hyperlink. setOpenExternalLinks for l2 is set to true. Hence, if this label is clicked, the associated URL will open in the browser. linkHovered signal of l4 is connected to hovered() function. So, whenever the mouse hovers over it, the function will be executed.

QPixmap object prepares offscreen image from python.jpg file. It is displayed as label l3 by using setPixmap() method

Plain text, hyperlink or rich text can also be displayed in QLabel.

In QLabel most of the basic HTML tags are allowed. For Example : h1,h2,h3,font,span,etc

You can visit here for the list of supported HTML subset.