edifice.Label#

class edifice.Label(text='', selectable=False, word_wrap=True, link_open=False, text_format=TextFormat.AutoText, **kwargs)[source]#

Bases: QtWidgetElement[QLabel]

Text display widget.

Props

All props from QtWidgetElement plus:

Parameters:
  • text (str) – The text to display.

  • word_wrap (bool) – Enable/disable word wrapping.

  • link_open (bool) – Whether hyperlinks will open to the operating system. Defaults to False. PySide6.QtWidgets.QLabel.setOpenExternalLinks

  • selectable (bool) – Whether the content of the label can be selected. Defaults to False.

  • text_format (TextFormat) – The text format of the label. Defaults to QtCore.Qt.TextFormat.AutoText. See QtCore.Qt.TextFormat.

Usage

Render rich text with the Qt supported HTML subset.

Label(
    text='''
        <h1>QLabel</h1>

        <p style='line-height:1.5;'>
        <code>QLabel</code> 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.
        </p>
        ''',
)

Note

The combination of rich text and word_wrap can sometimes cause Qt Layout Issues.

../_images/label.png

Methods

__init__([text, selectable, word_wrap, ...])

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.