S or /

SourceClass Label

from egui import Label
class Label:

Static text.

Usually it is more convenient to use Ui.label.

For full control of the text you can use egui.text.LayoutJob as argument to egui.Label().

Methods§

Sourcedef extend(self, /) -> Label§

Set egui.Label.wrap_mode to TextWrapMode.Extend, disabling wrapping and truncating, and instead expanding the parent Ui.

@staticmethod def from_widget_text(text: WidgetText) -> Label§
Sourcedef halign(self, /, align: Align) -> Label§

Sets the horizontal alignment of the Label to the given Align value.

Sourcedef layout_in_ui(self, /, ui: Ui) -> tuple[Pos2, Galley, Response]§

Do layout and position the galley in the ui, without painting it or adding widget info.

Sourcedef selectable(self, /, selectable: bool) -> Label§

Can the user select the text with the mouse?

Overrides egui.style.Interaction.selectable_labels.

Sourcedef sense(self, /, sense: Sense) -> Label§

Make the label respond to clicks and/or drags.

By default, a label is inert and does not respond to click or drags. By calling this you can turn the label into a button of sorts. This will also give the label the hover-effect of a button, but without the frame.

def show(self, /, ui: Ui) -> Response§
Sourcedef show_tooltip_when_elided(self, /, show: bool) -> Label§

Show the full text when hovered, if the text was elided.

By default, this is true.

Sourcedef text(self, /) -> str§
Sourcedef truncate(self, /) -> Label§
Sourcedef wrap(self, /) -> Label§
Sourcedef wrap_mode(self, /, wrap_mode: TextWrapMode) -> Label§

Set the wrap mode for the text.

By default, egui.Ui.wrap_mode will be used, which can be overridden with egui.Style.wrap_mode.

Note that any \n in the text will always produce a new line.