EditableLabel

class EditableLabel(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget, Editable

A GtkEditableLabel is a label that allows users to edit the text by switching to an “edit mode”.

https://docs.gtk.org/gtk4/editable-label.png

GtkEditableLabel does not have API of its own, but it implements the Editable interface.

The default bindings for activating the edit mode is to click or press the Enter key. The default bindings for leaving the edit mode are the Enter key (to save the results) or the Escape key (to cancel the editing).

CSS nodes

editablelabel[.editing]
╰── stack
    ├── label
    ╰── text

GtkEditableLabel has a main node with the name editablelabel. When the entry is in editing mode, it gets the .editing style class.

For all the subnodes added to the text node in various situations, see Text.

Constructors

class EditableLabel
classmethod new(str: str) Widget

Creates a new GtkEditableLabel widget.

Parameters:

str – the text for the label

Methods

class EditableLabel
get_editing() bool

Returns whether the label is currently in “editing mode”.

start_editing() None

Switches the label into “editing mode”.

stop_editing(commit: bool) None

Switches the label out of “editing mode”.

If commit is True, the resulting text is kept as the text property value, otherwise the resulting text is discarded and the label will keep its previous text property value.

Parameters:

commit – whether to set the edited text on the label

Properties

class EditableLabel
props.editing: bool

This property is True while the widget is in edit mode.