Gtk.EditableLabel

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Editable Gtk.Editable GObject.GInterface->Gtk.Editable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.EditableLabel Gtk.EditableLabel Gtk.Editable->Gtk.EditableLabel Gtk.Widget->Gtk.EditableLabel

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Editable (27)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (str)

get_editing ()

start_editing ()

stop_editing (commit)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.Editable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1), Gtk.Editable (8)

Name

Type

Flags

Short Description

editing

bool

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Class Details

class Gtk.EditableLabel(**kwargs)
Bases:

Gtk.Widget, Gtk.Editable

Abstract:

No

Structure:

Gtk.EditableLabelClass

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

An example Gtk.EditableLabel

GtkEditableLabel does not have API of its own, but it implements the [iface`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

`` 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 [class`Gtk`.Text].

classmethod new(str)[source]
Parameters:

str (str) – the text for the label

Returns:

the new GtkEditableLabel

Return type:

Gtk.Widget

Creates a new GtkEditableLabel widget.

get_editing()[source]
Returns:

True if self is currently in editing mode

Return type:

bool

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

start_editing()[source]

Switches the label into “editing mode”.

stop_editing(commit)[source]
Parameters:

commit (bool) – whether to set the edited text on the label

Switches the label out of “editing mode”.

If commit is True, the resulting text is kept as the [property`Gtk`.Editable:text] property value, otherwise the resulting text is discarded and the label will keep its previous [property`Gtk`.Editable:text] property value.

Property Details

Gtk.EditableLabel.props.editing
Name:

editing

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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