Skip to content

QLabel


QLabel is used for displaying text or an image. No user interaction functionality is provided.

Parameters:

Name Type Description Default
text str

The text to display.

None

Methods


Examples


label = QtWidgets.QLabel("Hello World!")
print(label.text())
'Hello World!'
label.setText("Goodbye World!")
print(label.text())
'Goodbye World!'


setText(text)

Sets the label's text to the given text.

Parameters:

Name Type Description Default
text str

The text to set.

required


text()

Returns the label's text.

Returns:

Type Description
str

The label's text.