:right-sidebar: True EditableLabel =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: EditableLabel(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Editable` A ``GtkEditableLabel`` is a label that allows users to edit the text by switching to an “edit mode”. .. image:: https://docs.gtk.org/gtk4/editable-label.png ``GtkEditableLabel`` does not have API of its own, but it implements the :obj:`~gi.repository.Gtk.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 --------- .. code-block:: :dedent: 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 :obj:`~gi.repository.Gtk.Text`. Constructors ------------ .. rst-class:: interim-class .. class:: EditableLabel :no-index: .. classmethod:: new(str: str) -> ~gi.repository.Gtk.Widget Creates a new ``GtkEditableLabel`` widget. :param str: the text for the label Methods ------- .. rst-class:: interim-class .. class:: EditableLabel :no-index: .. method:: get_editing() -> bool Returns whether the label is currently in “editing mode”. .. method:: start_editing() -> None Switches the label into “editing mode”. .. method:: stop_editing(commit: bool) -> None Switches the label out of “editing mode”. If ``commit`` is :const:`True`, the resulting text is kept as the :obj:`~gi.repository.Gtk.Editable.props.text` property value, otherwise the resulting text is discarded and the label will keep its previous :obj:`~gi.repository.Gtk.Editable.props.text` property value. :param commit: whether to set the edited text on the label Properties ---------- .. rst-class:: interim-class .. class:: EditableLabel :no-index: .. attribute:: props.editing :type: bool This property is :const:`True` while the widget is in edit mode.