Gtk.Entry

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.CellEditable Gtk.CellEditable GObject.GInterface->Gtk.CellEditable 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.Entry Gtk.Entry Gtk.CellEditable->Gtk.Entry Gtk.ConstraintTarget->Gtk.Widget Gtk.Editable->Gtk.Entry Gtk.Widget->Gtk.Entry

Example

../_images/Entry.png
Subclasses:

None

Methods

Inherited:

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

Structs:

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

class

new ()

class

new_with_buffer (buffer)

get_activates_default ()

get_alignment ()

get_attributes ()

get_buffer ()

get_completion ()

get_current_icon_drag_source ()

get_extra_menu ()

get_has_frame ()

get_icon_activatable (icon_pos)

get_icon_area (icon_pos)

get_icon_at_pos (x, y)

get_icon_gicon (icon_pos)

get_icon_name (icon_pos)

get_icon_paintable (icon_pos)

get_icon_sensitive (icon_pos)

get_icon_storage_type (icon_pos)

get_icon_tooltip_markup (icon_pos)

get_icon_tooltip_text (icon_pos)

get_input_hints ()

get_input_purpose ()

get_invisible_char ()

get_max_length ()

get_overwrite_mode ()

get_placeholder_text ()

get_progress_fraction ()

get_progress_pulse_step ()

get_tabs ()

get_text_length ()

get_visibility ()

grab_focus_without_selecting ()

progress_pulse ()

reset_im_context ()

set_activates_default (setting)

set_alignment (xalign)

set_attributes (attrs)

set_buffer (buffer)

set_completion (completion)

set_extra_menu (model)

set_has_frame (setting)

set_icon_activatable (icon_pos, activatable)

set_icon_drag_source (icon_pos, provider, actions)

set_icon_from_gicon (icon_pos, icon)

set_icon_from_icon_name (icon_pos, icon_name)

set_icon_from_paintable (icon_pos, paintable)

set_icon_sensitive (icon_pos, sensitive)

set_icon_tooltip_markup (icon_pos, tooltip)

set_icon_tooltip_text (icon_pos, tooltip)

set_input_hints (hints)

set_input_purpose (purpose)

set_invisible_char (ch)

set_max_length (max)

set_overwrite_mode (overwrite)

set_placeholder_text (text)

set_progress_fraction (fraction)

set_progress_pulse_step (fraction)

set_tabs (tabs)

set_visibility (visible)

unset_invisible_char ()

Virtual Methods

Inherited:

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

do_activate ()

Properties

Inherited:

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

Name

Type

Flags

Short Description

activates-default

bool

r/w/en

attributes

Pango.AttrList

r/w/en

buffer

Gtk.EntryBuffer

r/w/c/en

completion

Gtk.EntryCompletion

d/r/w/en

deprecated

enable-emoji-completion

bool

r/w/en

extra-menu

Gio.MenuModel

r/w/en

has-frame

bool

r/w/en

im-module

str

r/w/en

input-hints

Gtk.InputHints

r/w/en

input-purpose

Gtk.InputPurpose

r/w/en

invisible-char

int

r/w/en

invisible-char-set

bool

r/w

max-length

int

r/w/en

overwrite-mode

bool

r/w/en

placeholder-text

str

r/w/en

primary-icon-activatable

bool

r/w/en

primary-icon-gicon

Gio.Icon

r/w/en

primary-icon-name

str

r/w/en

primary-icon-paintable

Gdk.Paintable

r/w/en

primary-icon-sensitive

bool

r/w/en

primary-icon-storage-type

Gtk.ImageType

r

primary-icon-tooltip-markup

str

r/w/en

primary-icon-tooltip-text

str

r/w/en

progress-fraction

float

r/w/en

progress-pulse-step

float

r/w/en

scroll-offset

int

r/en

secondary-icon-activatable

bool

r/w/en

secondary-icon-gicon

Gio.Icon

r/w/en

secondary-icon-name

str

r/w/en

secondary-icon-paintable

Gdk.Paintable

r/w/en

secondary-icon-sensitive

bool

r/w/en

secondary-icon-storage-type

Gtk.ImageType

r

secondary-icon-tooltip-markup

str

r/w/en

secondary-icon-tooltip-text

str

r/w/en

show-emoji-icon

bool

r/w/en

tabs

Pango.TabArray

r/w/en

text-length

int

r

truncate-multiline

bool

r/w/en

visibility

bool

r/w/en

Signals

Inherited:

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

Name

Short Description

activate

Emitted when the entry is activated.

icon-press

Emitted when an activatable icon is clicked.

icon-release

Emitted on the button release from a mouse click over an activatable icon.

Fields

Inherited:

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

Name

Type

Access

Description

parent_instance

Gtk.Widget

r

Class Details

class Gtk.Entry(**kwargs)
Bases:

Gtk.Widget, Gtk.CellEditable, Gtk.Editable

Abstract:

No

Structure:

Gtk.EntryClass

GtkEntry is a single line text entry widget.

An example Gtk.Entry

A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

When using an entry for passwords and other sensitive information, it can be put into “password mode” using [method`Gtk`.Entry.set_visibility]. In this mode, entered text is displayed using a “invisible” character. By default, GTK picks the best invisible character that is available in the current font, but it can be changed with [method`Gtk`.Entry.set_invisible_char].

GtkEntry has the ability to display progress or activity information behind the text. To make an entry display such information, use [method`Gtk`.Entry.set_progress_fraction] or [method`Gtk`.Entry.set_progress_pulse_step].

Additionally, GtkEntry can show icons at either side of the entry. These icons can be activatable by clicking, can be set up as drag source and can have tooltips. To add an icon, use [method`Gtk`.Entry.set_icon_from_gicon] or one of the various other functions that set an icon from an icon name or a paintable. To trigger an action when the user clicks an icon, connect to the [signal`Gtk`.Entry::icon-press] signal. To allow DND operations from an icon, use [method`Gtk`.Entry.set_icon_drag_source]. To set a tooltip on an icon, use [method`Gtk`.Entry.set_icon_tooltip_text] or the corresponding function for markup.

Note that functionality or information that is only available by clicking on an icon in an entry may not be accessible at all to users which are not able to use a mouse or other pointing device. It is therefore recommended that any such functionality should also be available by other means, e.g. via the context menu of the entry.

CSS nodes

`` entry[.flat][.warning][.error] ├── text[.readonly] ├── image.left ├── image.right ╰── [progress[.pulse]] ``

GtkEntry has a main node with the name entry. Depending on the properties of the entry, the style classes .read-only and .flat may appear. The style classes .warning and .error may also be used with entries.

When the entry shows icons, it adds subnodes with the name image and the style class .left or .right, depending on where the icon appears.

When the entry shows progress, it adds a subnode with the name progress. The node has the style class .pulse when the shown progress is pulsing.

For all the subnodes added to the text node in various situations, see [class`Gtk`.Text].

Gtk.Entry as Gtk.Buildable

The GtkEntry implementation of the GtkBuildable interface supports a custom <attributes> element, which supports any number of <attribute> elements. The <attribute> element has attributes named “name“, “value“, “start“ and “end“ and allows you to specify PangoAttribute values for this label.

An example of a UI definition fragment specifying Pango attributes: ``xml <object class=”GtkEntry”>

<attributes>

<attribute name=”weight” value=”PANGO_WEIGHT_BOLD”/> <attribute name=”background” value=”red” start=”5” end=”10”/>

</attributes>

</object> ``

The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.

Accessibility

GtkEntry uses the Gtk.AccessibleRole.TEXT_BOX role.

classmethod new()[source]
Returns:

a new GtkEntry.

Return type:

Gtk.Widget

Creates a new entry.

classmethod new_with_buffer(buffer)[source]
Parameters:

buffer (Gtk.EntryBuffer) – The buffer to use for the new GtkEntry.

Returns:

a new GtkEntry

Return type:

Gtk.Widget

Creates a new entry with the specified text buffer.

get_activates_default()[source]
Returns:

True if the entry will activate the default widget

Return type:

bool

Retrieves the value set by Gtk.Entry.set_activates_default().

get_alignment()[source]
Returns:

the alignment

Return type:

float

Gets the value set by Gtk.Entry.set_alignment().

See also: [property`Gtk`.Editable:xalign]

get_attributes()[source]
Returns:

the attribute list

Return type:

Pango.AttrList or None

Gets the attribute list of the GtkEntry.

See [method`Gtk`.Entry.set_attributes].

get_buffer()[source]
Returns:

A GtkEntryBuffer object.

Return type:

Gtk.EntryBuffer

Get the GtkEntryBuffer object which holds the text for this widget.

get_completion()[source]
Returns:

The auxiliary completion object currently in use by self

Return type:

Gtk.EntryCompletion or None

Returns the auxiliary completion object currently in use by self.

Deprecated since version 4.10: Gtk.EntryCompletion will be removed in GTK 5.

get_current_icon_drag_source()[source]
Returns:

index of the icon which is the source of the current DND operation, or -1.

Return type:

int

Returns the index of the icon which is the source of the current DND operation, or -1.

get_extra_menu()[source]
Returns:

the menu model

Return type:

Gio.MenuModel or None

Gets the menu model set with Gtk.Entry.set_extra_menu().

get_has_frame()[source]
Returns:

whether the entry has a beveled frame

Return type:

bool

Gets the value set by Gtk.Entry.set_has_frame().

get_icon_activatable(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

True if the icon is activatable.

Return type:

bool

Returns whether the icon is activatable.

get_icon_area(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

Return location for the icon’s area

Return type:

icon_area: Gdk.Rectangle

Gets the area where entry’s icon at icon_pos is drawn.

This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized or has no icon at the given position, icon_area is filled with zeros. Otherwise, icon_area will be filled with the icon’s allocation, relative to self's allocation.

get_icon_at_pos(x, y)[source]
Parameters:
  • x (int) – the x coordinate of the position to find, relative to self

  • y (int) – the y coordinate of the position to find, relative to self

Returns:

the index of the icon at the given position, or -1

Return type:

int

Finds the icon at the given position and return its index.

The position’s coordinates are relative to the self’s top left corner. If x, y doesn’t lie inside an icon, -1 is returned. This function is intended for use in a [signal`Gtk`.Widget::query-tooltip] signal handler.

get_icon_gicon(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

A GIcon

Return type:

Gio.Icon or None

Retrieves the GIcon used for the icon.

None will be returned if there is no icon or if the icon was set by some other method (e.g., by GdkPaintable or icon name).

get_icon_name(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

An icon name

Return type:

str or None

Retrieves the icon name used for the icon.

None is returned if there is no icon or if the icon was set by some other method (e.g., by GdkPaintable or gicon).

get_icon_paintable(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

A GdkPaintable if no icon is set for this position or the icon set is not a GdkPaintable.

Return type:

Gdk.Paintable or None

Retrieves the GdkPaintable used for the icon.

If no GdkPaintable was used for the icon, None is returned.

get_icon_sensitive(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

True if the icon is sensitive.

Return type:

bool

Returns whether the icon appears sensitive or insensitive.

get_icon_storage_type(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

image representation being used

Return type:

Gtk.ImageType

Gets the type of representation being used by the icon to store image data.

If the icon has no image data, the return value will be Gtk.ImageType.EMPTY.

get_icon_tooltip_markup(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – the icon position

Returns:

the tooltip text

Return type:

str or None

Gets the contents of the tooltip on the icon at the specified position in self.

get_icon_tooltip_text(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – the icon position

Returns:

the tooltip text

Return type:

str or None

Gets the contents of the tooltip on the icon at the specified position in self.

get_input_hints()[source]
Returns:

the input hints

Return type:

Gtk.InputHints

Gets the input hints of this GtkEntry.

get_input_purpose()[source]
Returns:

the input purpose

Return type:

Gtk.InputPurpose

Gets the input purpose of the GtkEntry.

get_invisible_char()[source]
Returns:

the current invisible str, or 0, if the entry does not show invisible text at all.

Return type:

str

Retrieves the character displayed in place of the actual text in “password mode”.

get_max_length()[source]
Returns:

the maximum allowed number of characters in GtkEntry, or 0 if there is no maximum.

Return type:

int

Retrieves the maximum allowed length of the text in self.

See [method`Gtk`.Entry.set_max_length].

get_overwrite_mode()[source]
Returns:

whether the text is overwritten when typing.

Return type:

bool

Gets whether the GtkEntry is in overwrite mode.

get_placeholder_text()[source]
Returns:

a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. If no placeholder text has been set, None will be returned.

Return type:

str or None

Retrieves the text that will be displayed when self is empty and unfocused

get_progress_fraction()[source]
Returns:

a fraction from 0.0 to 1.0

Return type:

float

Returns the current fraction of the task that’s been completed.

See [method`Gtk`.Entry.set_progress_fraction].

get_progress_pulse_step()[source]
Returns:

a fraction from 0.0 to 1.0

Return type:

float

Retrieves the pulse step set with Gtk.Entry.set_progress_pulse_step().

get_tabs()[source]
Returns:

the tabstops

Return type:

Pango.TabArray or None

Gets the tabstops of the GtkEntry.

See [method`Gtk`.Entry.set_tabs].

get_text_length()[source]
Returns:

the current number of characters in GtkEntry, or 0 if there are none.

Return type:

int

Retrieves the current length of the text in self.

This is equivalent to getting self's GtkEntryBuffer and calling [method`Gtk`.EntryBuffer.get_length] on it.

get_visibility()[source]
Returns:

True if the text is currently visible

Return type:

bool

Retrieves whether the text in self is visible.

See [method`Gtk`.Entry.set_visibility].

grab_focus_without_selecting()[source]
Returns:

True if focus is now inside self

Return type:

bool

Causes self to have keyboard focus.

It behaves like [method`Gtk`.Widget.grab_focus], except that it doesn’t select the contents of the entry. You only want to call this on some special entries which the user usually doesn’t want to replace all text in, such as search-as-you-type entries.

progress_pulse()[source]

Indicates that some progress is made, but you don’t know how much.

Causes the entry’s progress indicator to enter “activity mode”, where a block bounces back and forth. Each call to Gtk.Entry.progress_pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by [method`Gtk`.Entry.set_progress_pulse_step]).

reset_im_context()[source]

Reset the input method context of the entry if needed.

This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.

set_activates_default(setting)[source]
Parameters:

setting (bool) – True to activate window’s default widget on Enter keypress

Sets whether pressing Enter in the self will activate the default widget for the window containing the entry.

This usually means that the dialog containing the entry will be closed, since the default widget is usually one of the dialog buttons.

set_alignment(xalign)[source]
Parameters:

xalign (float) – The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts

Sets the alignment for the contents of the entry.

This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.

See also: [property`Gtk`.Editable:xalign]

set_attributes(attrs)[source]
Parameters:

attrs (Pango.AttrList) – a PangoAttrList

Sets a PangoAttrList.

The attributes in the list are applied to the entry text.

Since the attributes will be applied to text that changes as the user types, it makes most sense to use attributes with unlimited extent.

set_buffer(buffer)[source]
Parameters:

buffer (Gtk.EntryBuffer) – a GtkEntryBuffer

Set the GtkEntryBuffer object which holds the text for this widget.

set_completion(completion)[source]
Parameters:

completion (Gtk.EntryCompletion or None) – The GtkEntryCompletion

Sets completion to be the auxiliary completion object to use with self.

All further configuration of the completion mechanism is done on completion using the GtkEntryCompletion API. Completion is disabled if completion is set to None.

Deprecated since version 4.10: Gtk.EntryCompletion will be removed in GTK 5.

set_extra_menu(model)[source]
Parameters:

model (Gio.MenuModel or None) – a GMenuModel

Sets a menu model to add when constructing the context menu for self.

set_has_frame(setting)[source]
Parameters:

setting (bool) – new value

Sets whether the entry has a beveled frame around it.

set_icon_activatable(icon_pos, activatable)[source]
Parameters:

Sets whether the icon is activatable.

set_icon_drag_source(icon_pos, provider, actions)[source]
Parameters:

Sets up the icon at the given position as drag source.

This makes it so that GTK will start a drag operation when the user clicks and drags the icon.

set_icon_from_gicon(icon_pos, icon)[source]
Parameters:

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon isn’t known, a “broken image” icon will be displayed instead.

If icon is None, no icon will be shown in the specified position.

set_icon_from_icon_name(icon_pos, icon_name)[source]
Parameters:

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon name isn’t known, a “broken image” icon will be displayed instead.

If icon_name is None, no icon will be shown in the specified position.

set_icon_from_paintable(icon_pos, paintable)[source]
Parameters:

Sets the icon shown in the specified position using a GdkPaintable.

If paintable is None, no icon will be shown in the specified position.

set_icon_sensitive(icon_pos, sensitive)[source]
Parameters:
  • icon_pos (Gtk.EntryIconPosition) – Icon position

  • sensitive (bool) – Specifies whether the icon should appear sensitive or insensitive

Sets the sensitivity for the specified icon.

set_icon_tooltip_markup(icon_pos, tooltip)[source]
Parameters:

Sets tooltip as the contents of the tooltip for the icon at the specified position.

tooltip is assumed to be marked up with Pango Markup.

Use None for tooltip to remove an existing tooltip.

See also [method`Gtk`.Widget.set_tooltip_markup] and [method`Gtk`.Entry.set_icon_tooltip_text].

set_icon_tooltip_text(icon_pos, tooltip)[source]
Parameters:

Sets tooltip as the contents of the tooltip for the icon at the specified position.

Use None for tooltip to remove an existing tooltip.

See also [method`Gtk`.Widget.set_tooltip_text] and [method`Gtk`.Entry.set_icon_tooltip_markup].

If you unset the widget tooltip via [method`Gtk`.Widget.set_tooltip_text] or [method`Gtk`.Widget.set_tooltip_markup], this sets [property`Gtk`.Widget:has-tooltip] to False, which suppresses icon tooltips too. You can resolve this by then calling [method`Gtk`.Widget.set_has_tooltip] to set [property`Gtk`.Widget:has-tooltip] back to True, or setting at least one non-empty tooltip on any icon achieves the same result.

set_input_hints(hints)[source]
Parameters:

hints (Gtk.InputHints) – the hints

Set additional hints which allow input methods to fine-tune their behavior.

set_input_purpose(purpose)[source]
Parameters:

purpose (Gtk.InputPurpose) – the purpose

Sets the input purpose which can be used by input methods to adjust their behavior.

set_invisible_char(ch)[source]
Parameters:

ch (str) – a Unicode character

Sets the character to use in place of the actual text in “password mode”.

See [method`Gtk`.Entry.set_visibility] for how to enable “password mode”.

By default, GTK picks the best invisible str available in the current font. If you set the invisible str to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

set_max_length(max)[source]
Parameters:

max (int) – the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

Sets the maximum allowed length of the contents of the widget.

If the current contents are longer than the given length, then they will be truncated to fit. The length is in characters.

This is equivalent to getting self's GtkEntryBuffer and calling [method`Gtk`.EntryBuffer.set_max_length] on it.

set_overwrite_mode(overwrite)[source]
Parameters:

overwrite (bool) – new value

Sets whether the text is overwritten when typing in the GtkEntry.

set_placeholder_text(text)[source]
Parameters:

text (str or None) – a string to be displayed when self is empty and unfocused

Sets text to be displayed in self when it is empty.

This can be used to give a visual hint of the expected contents of the GtkEntry.

set_progress_fraction(fraction)[source]
Parameters:

fraction (float) – fraction of the task that’s been completed

Causes the entry’s progress indicator to “fill in” the given fraction of the bar.

The fraction should be between 0.0 and 1.0, inclusive.

set_progress_pulse_step(fraction)[source]
Parameters:

fraction (float) – fraction between 0.0 and 1.0

Sets the fraction of total entry width to move the progress bouncing block for each pulse.

Use [method`Gtk`.Entry.progress_pulse] to pulse the progress.

set_tabs(tabs)[source]
Parameters:

tabs (Pango.TabArray or None) – a PangoTabArray

Sets a PangoTabArray.

The tabstops in the array are applied to the entry text.

set_visibility(visible)[source]
Parameters:

visible (bool) – True if the contents of the entry are displayed as plaintext

Sets whether the contents of the entry are visible or not.

When visibility is set to False, characters are displayed as the invisible str, and will also appear that way when the text in the entry widget is copied elsewhere.

By default, GTK picks the best invisible character available in the current font, but it can be changed with [method`Gtk`.Entry.set_invisible_char].

Note that you probably want to set [property`Gtk`.Entry:input-purpose] to Gtk.InputPurpose.PASSWORD or Gtk.InputPurpose.PIN to inform input methods about the purpose of this entry, in addition to setting visibility to False.

unset_invisible_char()[source]

Unsets the invisible str, so that the default invisible str is used again. See [method`Gtk`.Entry.set_invisible_char].

do_activate() virtual

Class handler for the GtkEntry::activate signal. The default implementation activates the gtk.activate-default action.

Signal Details

Gtk.Entry.signals.activate(entry)
Signal Name:

activate

Flags:

RUN_LAST, ACTION

Parameters:

entry (Gtk.Entry) – The object which received the signal

Emitted when the entry is activated.

The keybindings for this signal are all forms of the Enter key.

Gtk.Entry.signals.icon_press(entry, icon_pos)
Signal Name:

icon-press

Flags:

RUN_LAST

Parameters:

Emitted when an activatable icon is clicked.

Gtk.Entry.signals.icon_release(entry, icon_pos)
Signal Name:

icon-release

Flags:

RUN_LAST

Parameters:

Emitted on the button release from a mouse click over an activatable icon.

Property Details

Gtk.Entry.props.activates_default
Name:

activates-default

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to activate the default widget when Enter is pressed.

Gtk.Entry.props.attributes
Name:

attributes

Type:

Pango.AttrList

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of Pango attributes to apply to the text of the entry.

This is mainly useful to change the size or weight of the text.

The PangoAttribute’s start_index and end_index must refer to the [class`Gtk`.EntryBuffer] text, i.e. without the preedit string.

Gtk.Entry.props.buffer
Name:

buffer

Type:

Gtk.EntryBuffer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The buffer object which actually stores the text.

Gtk.Entry.props.completion
Name:

completion

Type:

Gtk.EntryCompletion

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The auxiliary completion object to use with the entry.

Deprecated since version 4.10: Gtk.EntryCompletion will be removed in GTK 5.

Gtk.Entry.props.enable_emoji_completion
Name:

enable-emoji-completion

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to suggest Emoji replacements for :-delimited names like :heart:.

Gtk.Entry.props.extra_menu
Name:

extra-menu

Type:

Gio.MenuModel

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A menu model whose contents will be appended to the context menu.

Gtk.Entry.props.has_frame
Name:

has-frame

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the entry should draw a frame.

Gtk.Entry.props.im_module
Name:

im-module

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Which IM (input method) module should be used for this entry.

See [class`Gtk`.IMContext].

Setting this to a non-None value overrides the system-wide IM module setting. See the Gtk.Settings [property`Gtk`.Settings:gtk-im-module] property.

Gtk.Entry.props.input_hints
Name:

input-hints

Type:

Gtk.InputHints

Default Value:

Gtk.InputHints.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Additional hints that allow input methods to fine-tune their behavior.

Also see [property`Gtk`.Entry:input-purpose]

Gtk.Entry.props.input_purpose
Name:

input-purpose

Type:

Gtk.InputPurpose

Default Value:

Gtk.InputPurpose.FREE_FORM

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The purpose of this text field.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Note that setting the purpose to Gtk.InputPurpose.PASSWORD or Gtk.InputPurpose.PIN is independent from setting [property`Gtk`.Entry:visibility].

Gtk.Entry.props.invisible_char
Name:

invisible-char

Type:

int

Default Value:

42

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The character to use when masking entry contents (“password mode”).

Gtk.Entry.props.invisible_char_set
Name:

invisible-char-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the invisible str has been set for the GtkEntry.

Gtk.Entry.props.max_length
Name:

max-length

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Maximum number of characters for this entry.

Gtk.Entry.props.overwrite_mode
Name:

overwrite-mode

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If text is overwritten when typing in the GtkEntry.

Gtk.Entry.props.placeholder_text
Name:

placeholder-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The text that will be displayed in the GtkEntry when it is empty and unfocused.

Gtk.Entry.props.primary_icon_activatable
Name:

primary-icon-activatable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the primary icon is activatable.

GTK emits the [signal`Gtk`.Entry::icon-press] and [signal`Gtk`.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Gtk.Entry.props.primary_icon_gicon
Name:

primary-icon-gicon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The GIcon to use for the primary icon for the entry.

Gtk.Entry.props.primary_icon_name
Name:

primary-icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The icon name to use for the primary icon for the entry.

Gtk.Entry.props.primary_icon_paintable
Name:

primary-icon-paintable

Type:

Gdk.Paintable

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A GdkPaintable to use as the primary icon for the entry.

Gtk.Entry.props.primary_icon_sensitive
Name:

primary-icon-sensitive

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signal`Gtk`.Entry::icon-press] and [signal`Gtk`.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Gtk.Entry.props.primary_icon_storage_type
Name:

primary-icon-storage-type

Type:

Gtk.ImageType

Default Value:

Gtk.ImageType.EMPTY

Flags:

READABLE

The representation which is used for the primary icon of the entry.

Gtk.Entry.props.primary_icon_tooltip_markup
Name:

primary-icon-tooltip-markup

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The contents of the tooltip on the primary icon, with markup.

Also see [method`Gtk`.Entry.set_icon_tooltip_markup].

Gtk.Entry.props.primary_icon_tooltip_text
Name:

primary-icon-tooltip-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The contents of the tooltip on the primary icon.

Also see [method`Gtk`.Entry.set_icon_tooltip_text].

Gtk.Entry.props.progress_fraction
Name:

progress-fraction

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The current fraction of the task that’s been completed.

Gtk.Entry.props.progress_pulse_step
Name:

progress-pulse-step

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The fraction of total entry width to move the progress bouncing block for each pulse.

See [method`Gtk`.Entry.progress_pulse].

Gtk.Entry.props.scroll_offset
Name:

scroll-offset

Type:

int

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

Number of pixels of the entry scrolled off the screen to the left.

Gtk.Entry.props.secondary_icon_activatable
Name:

secondary-icon-activatable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the secondary icon is activatable.

GTK emits the [signal`Gtk`.Entry::icon-press] and [signal`Gtk`.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Gtk.Entry.props.secondary_icon_gicon
Name:

secondary-icon-gicon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The GIcon to use for the secondary icon for the entry.

Gtk.Entry.props.secondary_icon_name
Name:

secondary-icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The icon name to use for the secondary icon for the entry.

Gtk.Entry.props.secondary_icon_paintable
Name:

secondary-icon-paintable

Type:

Gdk.Paintable

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A GdkPaintable to use as the secondary icon for the entry.

Gtk.Entry.props.secondary_icon_sensitive
Name:

secondary-icon-sensitive

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signal`Gtk`.Entry::icon-press[ and [signal`Gtk`.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Gtk.Entry.props.secondary_icon_storage_type
Name:

secondary-icon-storage-type

Type:

Gtk.ImageType

Default Value:

Gtk.ImageType.EMPTY

Flags:

READABLE

The representation which is used for the secondary icon of the entry.

Gtk.Entry.props.secondary_icon_tooltip_markup
Name:

secondary-icon-tooltip-markup

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The contents of the tooltip on the secondary icon, with markup.

Also see [method`Gtk`.Entry.set_icon_tooltip_markup].

Gtk.Entry.props.secondary_icon_tooltip_text
Name:

secondary-icon-tooltip-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The contents of the tooltip on the secondary icon.

Also see [method`Gtk`.Entry.set_icon_tooltip_text].

Gtk.Entry.props.show_emoji_icon
Name:

show-emoji-icon

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Gtk.Entry.props.tabs
Name:

tabs

Type:

Pango.TabArray

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Gtk.Entry.props.text_length
Name:

text-length

Type:

int

Default Value:

0

Flags:

READABLE

The length of the text in the GtkEntry.

Gtk.Entry.props.truncate_multiline
Name:

truncate-multiline

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

When True, pasted multi-line text is truncated to the first line.

Gtk.Entry.props.visibility
Name:

visibility

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the entry should show the “invisible str” instead of the actual text (“password mode”).