Skip to content

Gtk.Entry

class — extends Widget, Accessible, Buildable, CellEditable, ConstraintTarget, Editable

A single-line text entry widget.

<picture> <source srcset="entry-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkEntry" src="entry.png"> </picture>

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 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 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 Entry.set_progress_fraction or 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 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 Entry.icon-press signal. To allow DND operations from an icon, use Entry.set_icon_drag_source. To set a tooltip on an icon, use 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 Text.

GtkEntry as GtkBuildable

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:

<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 AccessibleRole.text_box role.

Constructors

new

@classmethod
def new(cls) -> Widget

Creates a new entry.

new_with_buffer

@classmethod
def new_with_buffer(cls, buffer: EntryBuffer) -> Widget

Creates a new entry with the specified text buffer.

Parameters:

  • buffer — The buffer to use for the new GtkEntry.

Methods

get_activates_default

def get_activates_default(self) -> bool

Retrieves the value set by Entry.set_activates_default.

get_alignment

def get_alignment(self) -> float

Gets the value set by Entry.set_alignment.

See also: Editable.xalign

get_attributes

def get_attributes(self) -> Pango.AttrList | None

Gets the attribute list of the GtkEntry.

See Entry.set_attributes.

get_buffer

def get_buffer(self) -> EntryBuffer

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

get_completion

def get_completion(self) -> EntryCompletion | None

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns the auxiliary completion object currently in use by entry.

get_current_icon_drag_source

def get_current_icon_drag_source(self) -> int

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

get_extra_menu

def get_extra_menu(self) -> Gio.MenuModel | None

Gets the menu model set with Entry.set_extra_menu.

get_has_frame

def get_has_frame(self) -> bool

Gets the value set by Entry.set_has_frame.

get_icon_activatable

def get_icon_activatable(self, icon_pos: EntryIconPosition | int) -> bool

Returns whether the icon is activatable.

Parameters:

  • icon_pos — Icon position

get_icon_area

def get_icon_area(self, icon_pos: EntryIconPosition | int) -> 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 entry's allocation.

Parameters:

  • icon_pos — Icon position

get_icon_at_pos

def get_icon_at_pos(self, x: int, y: int) -> int

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

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

Parameters:

  • x — the x coordinate of the position to find, relative to entry
  • y — the y coordinate of the position to find, relative to entry

get_icon_gicon

def get_icon_gicon(self, icon_pos: EntryIconPosition | int) -> Gio.Icon | 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).

Parameters:

  • icon_pos — Icon position

get_icon_name

def get_icon_name(self, icon_pos: EntryIconPosition | int) -> str | 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).

Parameters:

  • icon_pos — Icon position

get_icon_paintable

def get_icon_paintable(self, icon_pos: EntryIconPosition | int) -> Gdk.Paintable | None

Retrieves the GdkPaintable used for the icon.

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

Parameters:

  • icon_pos — Icon position

get_icon_sensitive

def get_icon_sensitive(self, icon_pos: EntryIconPosition | int) -> bool

Returns whether the icon appears sensitive or insensitive.

Parameters:

  • icon_pos — Icon position

get_icon_storage_type

def get_icon_storage_type(self, icon_pos: EntryIconPosition | int) -> 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 ImageType.EMPTY.

Parameters:

  • icon_pos — Icon position

get_icon_tooltip_markup

def get_icon_tooltip_markup(self, icon_pos: EntryIconPosition | int) -> str | None

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

Parameters:

  • icon_pos — the icon position

get_icon_tooltip_text

def get_icon_tooltip_text(self, icon_pos: EntryIconPosition | int) -> str | None

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

Parameters:

  • icon_pos — the icon position

get_input_hints

def get_input_hints(self) -> InputHints

Gets the input hints of this GtkEntry.

get_input_purpose

def get_input_purpose(self) -> InputPurpose

Gets the input purpose of the GtkEntry.

get_invisible_char

def get_invisible_char(self) -> str

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

get_max_length

def get_max_length(self) -> int

Retrieves the maximum allowed length of the text in entry.

See Entry.set_max_length.

get_menu_entry_icon_text

def get_menu_entry_icon_text(self, icon_pos: EntryIconPosition | int) -> str | None

Gets the text that will be used in the context menu of the GtkEntry when the specified icon is activatable. Selecting this item in the menu results, from all aspects, the same than clicking on the specified icon. This greatly simplifies making accessible applications, because the icons aren't focusable when using keyboard navigation. This is why Gtk recommends to add the same action to the context menu.

Parameters:

  • icon_pos — either GTK_ENTRY_ICON_PRIMARY or GTK_ENTRY_ICON_SECONDARY

get_overwrite_mode

def get_overwrite_mode(self) -> bool

Gets whether the GtkEntry is in overwrite mode.

get_placeholder_text

def get_placeholder_text(self) -> str | None

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

get_progress_fraction

def get_progress_fraction(self) -> float

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

See Entry.set_progress_fraction.

get_progress_pulse_step

def get_progress_pulse_step(self) -> float

Retrieves the pulse step set with Entry.set_progress_pulse_step.

get_tabs

def get_tabs(self) -> Pango.TabArray | None

Gets the tabstops of the GtkEntry.

See Entry.set_tabs.

get_text_length

def get_text_length(self) -> int

Retrieves the current length of the text in entry.

This is equivalent to getting entry's GtkEntryBuffer and calling EntryBuffer.get_length on it.

get_visibility

def get_visibility(self) -> bool

Retrieves whether the text in entry is visible.

See Entry.set_visibility.

grab_focus_without_selecting

def grab_focus_without_selecting(self) -> bool

Causes entry to have keyboard focus.

It behaves like 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

def progress_pulse(self) -> None

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 Entry.progress_pulse causes the block to move by a little bit (the amount of movement per pulse is determined by Entry.set_progress_pulse_step).

reset_im_context

def reset_im_context(self) -> None

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

def set_activates_default(self, setting: bool) -> None

Sets whether pressing Enter in the entry 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.

Parameters:

  • settingTrue to activate window’s default widget on Enter keypress

set_alignment

def set_alignment(self, xalign: float) -> None

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: Editable.xalign

Parameters:

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

set_attributes

def set_attributes(self, attrs: Pango.AttrList) -> None

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.

Parameters:

  • attrs — a PangoAttrList

set_buffer

def set_buffer(self, buffer: EntryBuffer) -> None

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

Parameters:

  • buffer — a GtkEntryBuffer

set_completion

def set_completion(self, completion: EntryCompletion | None = ...) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

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

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

Parameters:

  • completion — The GtkEntryCompletion

set_extra_menu

def set_extra_menu(self, model: Gio.MenuModel | None = ...) -> None

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

Parameters:

  • model — a GMenuModel

set_has_frame

def set_has_frame(self, setting: bool) -> None

Sets whether the entry has a beveled frame around it.

Parameters:

  • setting — new value

set_icon_activatable

def set_icon_activatable(self, icon_pos: EntryIconPosition | int, activatable: bool) -> None

Sets whether the icon is activatable.

Parameters:

  • icon_pos — Icon position
  • activatableTrue if the icon should be activatable

set_icon_drag_source

def set_icon_drag_source(self, icon_pos: EntryIconPosition | int, provider: Gdk.ContentProvider, actions: Gdk.DragAction | int) -> None

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.

Parameters:

  • icon_pos — icon position
  • provider — a GdkContentProvider
  • actions — a bitmask of the allowed drag actions

set_icon_from_gicon

def set_icon_from_gicon(self, icon_pos: EntryIconPosition | int, icon: Gio.Icon | None = ...) -> None

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.

Parameters:

  • icon_pos — The position at which to set the icon
  • icon — The icon to set

set_icon_from_icon_name

def set_icon_from_icon_name(self, icon_pos: EntryIconPosition | int, icon_name: str | None = ...) -> None

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.

Parameters:

  • icon_pos — The position at which to set the icon
  • icon_name — An icon name

set_icon_from_paintable

def set_icon_from_paintable(self, icon_pos: EntryIconPosition | int, paintable: Gdk.Paintable | None = ...) -> None

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

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

Parameters:

  • icon_pos — Icon position
  • paintable — A GdkPaintable

set_icon_sensitive

def set_icon_sensitive(self, icon_pos: EntryIconPosition | int, sensitive: bool) -> None

Sets the sensitivity for the specified icon.

Parameters:

  • icon_pos — Icon position
  • sensitive — Specifies whether the icon should appear sensitive or insensitive

set_icon_tooltip_markup

def set_icon_tooltip_markup(self, icon_pos: EntryIconPosition | int, tooltip: str | None = ...) -> None

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 Widget.set_tooltip_markup and Entry.set_icon_tooltip_text.

Parameters:

  • icon_pos — the icon position
  • tooltip — the contents of the tooltip for the icon

set_icon_tooltip_text

def set_icon_tooltip_text(self, icon_pos: EntryIconPosition | int, tooltip: str | None = ...) -> None

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 Widget.set_tooltip_text and Entry.set_icon_tooltip_markup.

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

Parameters:

  • icon_pos — the icon position
  • tooltip — the contents of the tooltip for the icon

set_input_hints

def set_input_hints(self, hints: InputHints | int) -> None

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

Parameters:

  • hints — the hints

set_input_purpose

def set_input_purpose(self, purpose: InputPurpose | int) -> None

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

Parameters:

  • purpose — the purpose

set_invisible_char

def set_invisible_char(self, ch: str) -> None

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

See Entry.set_visibility for how to enable “password mode”.

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

Parameters:

  • ch — a Unicode character

set_max_length

def set_max_length(self, max: int) -> None

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 entry's GtkEntryBuffer and calling EntryBuffer.set_max_length on it.

Parameters:

  • max — 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.

set_menu_entry_icon_text

def set_menu_entry_icon_text(self, icon_pos: EntryIconPosition | int, text: str) -> None

Sets the text that will be used in the context menu of the GtkEntry when the specified icon is activatable. Selecting this item in the menu results, from all aspects, the same than clicking on the specified icon. This greatly simplifies making accessible applications, because the icons aren't focusable when using keyboard navigation. This is why Gtk recommends to add the same action to the context menu.

Parameters:

  • icon_pos — either GTK_ENTRY_ICON_PRIMARY or GTK_ENTRY_ICON_SECONDARY
  • text — the text used for the menu item in the context menu, or NULL to not add a menu item.

set_overwrite_mode

def set_overwrite_mode(self, overwrite: bool) -> None

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

Parameters:

  • overwrite — new value

set_placeholder_text

def set_placeholder_text(self, text: str | None = ...) -> None

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

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

Parameters:

  • text — a string to be displayed when entry is empty and unfocused

set_progress_fraction

def set_progress_fraction(self, fraction: float) -> None

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.

Parameters:

  • fraction — fraction of the task that’s been completed

set_progress_pulse_step

def set_progress_pulse_step(self, fraction: float) -> None

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

Use Entry.progress_pulse to pulse the progress.

Parameters:

  • fraction — fraction between 0.0 and 1.0

set_tabs

def set_tabs(self, tabs: Pango.TabArray | None = ...) -> None

Sets a PangoTabArray.

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

Parameters:

  • tabs — a PangoTabArray

set_visibility

def set_visibility(self, visible: bool) -> None

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

When visibility is set to False, characters are displayed as the invisible char, 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 Entry.set_invisible_char.

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

Parameters:

  • visibleTrue if the contents of the entry are displayed as plaintext

unset_invisible_char

def unset_invisible_char(self) -> None

Unsets the invisible char, so that the default invisible char is used again. See Entry.set_invisible_char.

Virtual methods

do_activate

def do_activate(self) -> None

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

Properties

activates_default

activates_default: bool  # read/write

Whether to activate the default widget when Enter is pressed.

attributes

attributes: Pango.AttrList  # read/write

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 EntryBuffer text, i.e. without the preedit string.

buffer

buffer: EntryBuffer  # read/write

The buffer object which actually stores the text.

completion

completion: EntryCompletion  # read/write

:::warning Deprecated since 4.10 This API is deprecated. :::

The auxiliary completion object to use with the entry.

enable_emoji_completion

enable_emoji_completion: bool  # read/write

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

extra_menu

extra_menu: Gio.MenuModel  # read/write

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

has_frame

has_frame: bool  # read/write

Whether the entry should draw a frame.

im_module

im_module: str  # read/write

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

See IMContext.

Setting this to a non-None value overrides the system-wide IM module setting. See the GtkSettings Settings.gtk-im-module property.

input_hints

input_hints: InputHints | int  # read/write

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

Also see Entry.input-purpose

input_purpose

input_purpose: InputPurpose | int  # read/write

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 InputPurpose.PASSWORD or InputPurpose.PIN is independent from setting Entry.visibility.

invisible_char

invisible_char: int  # read/write

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

invisible_char_set

invisible_char_set: bool  # read/write

Whether the invisible char has been set for the GtkEntry.

max_length

max_length: int  # read/write

Maximum number of characters for this entry.

menu_entry_icon_primary_text

menu_entry_icon_primary_text: str  # read/write

Text for an item in the context menu to activate the primary icon action.

When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren't focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

menu_entry_icon_secondary_text

menu_entry_icon_secondary_text: str  # read/write

Text for an item in the context menu to activate the secondary icon action.

When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren't focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

overwrite_mode

overwrite_mode: bool  # read/write

If text is overwritten when typing in the GtkEntry.

placeholder_text

placeholder_text: str  # read/write

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

primary_icon_activatable

primary_icon_activatable: bool  # read/write

Whether the primary icon is activatable.

GTK emits the Entry.icon-press and Entry.icon-release signals only on sensitive, activatable icons.

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

primary_icon_gicon

primary_icon_gicon: Gio.Icon  # read/write

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

primary_icon_name

primary_icon_name: str  # read/write

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

primary_icon_paintable

primary_icon_paintable: Gdk.Paintable  # read/write

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

primary_icon_sensitive

primary_icon_sensitive: bool  # read/write

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the Entry.icon-press and 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.

primary_icon_storage_type

primary_icon_storage_type: ImageType | int  # read-only

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

primary_icon_tooltip_markup

primary_icon_tooltip_markup: str  # read/write

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

Also see Entry.set_icon_tooltip_markup.

primary_icon_tooltip_text

primary_icon_tooltip_text: str  # read/write

The contents of the tooltip on the primary icon.

Also see Entry.set_icon_tooltip_text.

progress_fraction

progress_fraction: float  # read/write

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

progress_pulse_step

progress_pulse_step: float  # read/write

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

See Entry.progress_pulse.

scroll_offset

scroll_offset: int  # read-only

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

secondary_icon_activatable

secondary_icon_activatable: bool  # read/write

Whether the secondary icon is activatable.

GTK emits the Entry.icon-press and Entry.icon-release signals only on sensitive, activatable icons.

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

secondary_icon_gicon

secondary_icon_gicon: Gio.Icon  # read/write

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

secondary_icon_name

secondary_icon_name: str  # read/write

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

secondary_icon_paintable

secondary_icon_paintable: Gdk.Paintable  # read/write

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

secondary_icon_sensitive

secondary_icon_sensitive: bool  # read/write

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signalGtk.Entry::icon-press[ and 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.

secondary_icon_storage_type

secondary_icon_storage_type: ImageType | int  # read-only

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

secondary_icon_tooltip_markup

secondary_icon_tooltip_markup: str  # read/write

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

Also see Entry.set_icon_tooltip_markup.

secondary_icon_tooltip_text

secondary_icon_tooltip_text: str  # read/write

The contents of the tooltip on the secondary icon.

Also see Entry.set_icon_tooltip_text.

show_emoji_icon

show_emoji_icon: bool  # read/write

Whether the entry will show an Emoji icon in the secondary icon position to open the Emoji chooser.

tabs

tabs: Pango.TabArray  # read/write

A list of tabstops to apply to the text of the entry.

text_length

text_length: int  # read-only

The length of the text in the GtkEntry.

truncate_multiline

truncate_multiline: bool  # read/write

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

visibility

visibility: bool  # read/write

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

Signals

activate

def on_activate(self) -> None: ...

Emitted when the entry is activated.

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

icon-press

def on_icon_press(self, icon_pos: EntryIconPosition) -> None: ...

Emitted when an activatable icon is clicked.

icon-release

def on_icon_release(self, icon_pos: EntryIconPosition) -> None: ...

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