Gtk.Entry

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.CellEditable Gtk.CellEditable GObject.GInterface->Gtk.CellEditable Gtk.Editable Gtk.Editable GObject.GInterface->Gtk.Editable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Entry Gtk.Entry Gtk.CellEditable->Gtk.Entry Gtk.Editable->Gtk.Entry Gtk.Widget->Gtk.Entry

Example

../_images/Entry.png
Subclasses:

Gtk.SearchEntry, Gtk.SpinButton

Methods

Inherited:

Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.CellEditable (3), Gtk.Editable (13)

Structs:

Gtk.WidgetClass (12), 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_cursor_hadjustment ()

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_pixbuf (icon_pos)

get_icon_sensitive (icon_pos)

get_icon_stock (icon_pos)

get_icon_storage_type (icon_pos)

get_icon_tooltip_markup (icon_pos)

get_icon_tooltip_text (icon_pos)

get_inner_border ()

get_input_hints ()

get_input_purpose ()

get_invisible_char ()

get_layout ()

get_layout_offsets ()

get_max_length ()

get_max_width_chars ()

get_overwrite_mode ()

get_placeholder_text ()

get_progress_fraction ()

get_progress_pulse_step ()

get_tabs ()

get_text ()

get_text_area ()

get_text_length ()

get_visibility ()

get_width_chars ()

grab_focus_without_selecting ()

im_context_filter_keypress (event)

layout_index_to_text_index (layout_index)

progress_pulse ()

reset_im_context ()

set_activates_default (setting)

set_alignment (xalign)

set_attributes (attrs)

set_buffer (buffer)

set_completion (completion)

set_cursor_hadjustment (adjustment)

set_has_frame (setting)

set_icon_activatable (icon_pos, activatable)

set_icon_drag_source (icon_pos, target_list, actions)

set_icon_from_gicon (icon_pos, icon)

set_icon_from_icon_name (icon_pos, icon_name)

set_icon_from_pixbuf (icon_pos, pixbuf)

set_icon_from_stock (icon_pos, stock_id)

set_icon_sensitive (icon_pos, sensitive)

set_icon_tooltip_markup (icon_pos, tooltip)

set_icon_tooltip_text (icon_pos, tooltip)

set_inner_border (border)

set_input_hints (hints)

set_input_purpose (purpose)

set_invisible_char (ch)

set_max_length (max)

set_max_width_chars (n_chars)

set_overwrite_mode (overwrite)

set_placeholder_text (text)

set_progress_fraction (fraction)

set_progress_pulse_step (fraction)

set_tabs (tabs)

set_text (text)

set_visibility (visible)

set_width_chars (n_chars)

text_index_to_layout_index (text_index)

unset_invisible_char ()

Virtual Methods

Inherited:

Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.CellEditable (3), Gtk.Editable (10)

do_activate ()

do_backspace ()

do_copy_clipboard ()

do_cut_clipboard ()

do_delete_from_cursor (type, count)

do_get_frame_size (x, y, width, height)

do_get_text_area_size (x, y, width, height)

do_insert_at_cursor (str)

do_insert_emoji ()

do_move_cursor (step, count, extend_selection)

do_paste_clipboard ()

do_populate_popup (popup)

do_toggle_overwrite ()

Properties

Inherited:

Gtk.Widget (39), Gtk.CellEditable (1)

Name

Type

Flags

Short Description

activates-default

bool

r/w/en

Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed

attributes

Pango.AttrList

r/w/en

A list of style attributes to apply to the text of the label

buffer

Gtk.EntryBuffer

r/w/c/en

Text buffer object which actually stores entry text

caps-lock-warning

bool

r/w/en

Whether password entries will show a warning when Caps Lock is on

completion

Gtk.EntryCompletion

r/w/en

The auxiliary completion object

cursor-position

int

r

The current position of the insertion cursor in chars

editable

bool

r/w/en

Whether the entry contents can be edited

enable-emoji-completion

bool

r/w/en

Whether to suggest Emoji replacements

has-frame

bool

r/w/en

False removes outside bevel from entry

im-module

str

r/w/en

Which IM module should be used

inner-border

Gtk.Border

d/r/w/en

Border between text and frame. Overrides the inner-border style property deprecated

input-hints

Gtk.InputHints

r/w/en

Hints for the text field behaviour

input-purpose

Gtk.InputPurpose

r/w/en

Purpose of the text field

invisible-char

int

r/w/en

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

invisible-char-set

bool

r/w

Whether the invisible character has been set

max-length

int

r/w/en

Maximum number of characters for this entry. Zero if no maximum

max-width-chars

int

r/w/en

The desired maximum width of the entry, in characters

overwrite-mode

bool

r/w/en

Whether new text overwrites existing text

placeholder-text

str

r/w/en

Show text in the entry when it’s empty and unfocused

populate-all

bool

r/w/en

Whether to emit ::populate-popup for touch popups

primary-icon-activatable

bool

r/w/en

Whether the primary icon is activatable

primary-icon-gicon

Gio.Icon

r/w/en

Gio.Icon for primary icon

primary-icon-name

str

r/w/en

Icon name for primary icon

primary-icon-pixbuf

GdkPixbuf.Pixbuf

r/w/en

Primary pixbuf for the entry

primary-icon-sensitive

bool

r/w/en

Whether the primary icon is sensitive

primary-icon-stock

str

d/r/w/en

Stock ID for primary icon deprecated

primary-icon-storage-type

Gtk.ImageType

r

The representation being used for primary icon

primary-icon-tooltip-markup

str

r/w/en

The contents of the tooltip on the primary icon

primary-icon-tooltip-text

str

r/w/en

The contents of the tooltip on the primary icon

progress-fraction

float

r/w/en

The current fraction of the task that’s been completed

progress-pulse-step

float

r/w/en

The fraction of total entry width to move the progress bouncing block for each call to Gtk.Entry.progress_pulse()

scroll-offset

int

r/en

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

secondary-icon-activatable

bool

r/w/en

Whether the secondary icon is activatable

secondary-icon-gicon

Gio.Icon

r/w/en

Gio.Icon for secondary icon

secondary-icon-name

str

r/w/en

Icon name for secondary icon

secondary-icon-pixbuf

GdkPixbuf.Pixbuf

r/w/en

Secondary pixbuf for the entry

secondary-icon-sensitive

bool

r/w/en

Whether the secondary icon is sensitive

secondary-icon-stock

str

d/r/w/en

Stock ID for secondary icon deprecated

secondary-icon-storage-type

Gtk.ImageType

r

The representation being used for secondary icon

secondary-icon-tooltip-markup

str

r/w/en

The contents of the tooltip on the secondary icon

secondary-icon-tooltip-text

str

r/w/en

The contents of the tooltip on the secondary icon

selection-bound

int

r

The position of the opposite end of the selection from the cursor in chars

shadow-type

Gtk.ShadowType

d/r/w/en

Which kind of shadow to draw around the entry when has-frame is set deprecated

show-emoji-icon

bool

r/w/en

Whether to show an icon for Emoji

tabs

Pango.TabArray

r/w/en

A list of tabstop locations to apply to the text of the entry

text

str

r/w/en

The contents of the entry

text-length

int

r

Length of the text currently in the entry

truncate-multiline

bool

r/w/en

Whether to truncate multiline pastes to one line.

visibility

bool

r/w/en

False displays the “invisible str" instead of the actual text (password mode)

width-chars

int

r/w/en

Number of characters to leave space for in the entry

xalign

float

r/w/en

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

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

icon-prelight

bool

True

d/r

Whether activatable icons should prelight when hovered deprecated

inner-border

Gtk.Border

None

d/r

Border between text and frame. deprecated

invisible-char

int

0

r

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

progress-border

Gtk.Border

None

d/r

Border around the progress bar deprecated

Signals

Inherited:

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

Name

Short Description

activate

The ::activate signal is emitted when the user hits the Enter key.

backspace

The ::backspace signal is a keybinding signal which gets emitted when the user asks for it.

copy-clipboard

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard.

cut-clipboard

The ::cut-clipboard signal is a keybinding signal which gets emitted to cut the selection to the clipboard.

delete-from-cursor

The ::delete-from-cursor signal is a keybinding signal which gets emitted when the user initiates a text deletion.

icon-press

The ::icon-press signal is emitted when an activatable icon is clicked.

icon-release

The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon.

insert-at-cursor

The ::insert-at-cursor signal is a keybinding signal which gets emitted when the user initiates the insertion of a fixed string at the cursor.

insert-emoji

The ::insert-emoji signal is a keybinding signal which gets emitted to present the Emoji chooser for the entry.

move-cursor

The ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement.

paste-clipboard

The ::paste-clipboard signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view.

populate-popup

The ::populate-popup signal gets emitted before showing the context menu of the entry.

preedit-changed

If an input method is used, the typed text will not immediately be committed to the buffer.

toggle-overwrite

The ::toggle-overwrite signal is a keybinding signal which gets emitted to toggle the overwrite mode of the entry.

Fields

Inherited:

Gtk.Widget (69), 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

The Gtk.Entry widget is a single line text entry widget. 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 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 Gtk.Entry.set_invisible_char(). Since 2.16, GTK+ displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the Gtk.Entry :caps-lock-warning property.

Since 2.16, Gtk.Entry has the ability to display progress or activity information behind the text. To make an entry display such information, use Gtk.Entry.set_progress_fraction() or Gtk.Entry.set_progress_pulse_step().

Additionally, Gtk.Entry 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 Gtk.Entry.set_icon_from_gicon() or one of the various other functions that set an icon from a stock id, an icon name or a pixbuf. To trigger an action when the user clicks an icon, connect to the Gtk.Entry ::icon-press signal. To allow DND operations from an icon, use Gtk.Entry.set_icon_drag_source(). To set a tooltip on an icon, use 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[.read-only][.flat][.warning][.error]
├── image.left
├── image.right
├── undershoot.left
├── undershoot.right
├── [selection]
├── [progress[.pulse]]
╰── [window.popup]

Gtk.Entry 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 has a selection, it adds a subnode with the name selection.

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.

The CSS node for a context menu is added as a subnode below entry as well.

The undershoot nodes are used to draw the underflow indication when content is scrolled out of view. These nodes get the .left and .right style classes added depending on where the indication is drawn.

When touch is used and touch selection handles are shown, they are using CSS nodes with name cursor-handle. They get the .top or .bottom style class depending on where they are shown in relation to the selection. If there is just a single handle for the text cursor, it gets the style class .insertion-cursor.

classmethod new()[source]
Returns:

a new Gtk.Entry.

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 Gtk.Entry.

Returns:

a new Gtk.Entry

Return type:

Gtk.Widget

Creates a new entry with the specified text buffer.

New in version 2.18.

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().

New in version 2.4.

get_attributes()[source]
Returns:

the attribute list, or None if none was set.

Return type:

Pango.AttrList or None

Gets the attribute list that was set on the entry using Gtk.Entry.set_attributes(), if any.

New in version 3.6.

get_buffer()[source]
Returns:

A Gtk.EntryBuffer object.

Return type:

Gtk.EntryBuffer

Get the Gtk.EntryBuffer object which holds the text for this widget.

New in version 2.18.

get_completion()[source]
Returns:

The auxiliary completion object currently in use by self.

Return type:

Gtk.EntryCompletion

Returns the auxiliary completion object currently in use by self.

New in version 2.4.

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.

This function is meant to be used in a Gtk.Widget ::drag-data-get callback.

New in version 2.16.

get_cursor_hadjustment()[source]
Returns:

the horizontal cursor adjustment, or None if none has been set.

Return type:

Gtk.Adjustment or None

Retrieves the horizontal cursor adjustment for the entry. See Gtk.Entry.set_cursor_hadjustment().

New in version 2.12.

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.

New in version 2.16.

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.

See also Gtk.Entry.get_text_area()

New in version 3.0.

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

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

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 Gtk.Widget ::query-tooltip signal handler.

New in version 2.16.

get_icon_gicon(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

A Gio.Icon, or None if no icon is set or if the icon is not a Gio.Icon

Return type:

Gio.Icon or None

Retrieves the Gio.Icon used for the icon, or None if there is no icon or if the icon was set by some other method (e.g., by stock, pixbuf, or icon name).

New in version 2.16.

get_icon_name(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

An icon name, or None if no icon is set or if the icon wasn’t set from an icon name

Return type:

str or None

Retrieves the icon name used for the icon, or None if there is no icon or if the icon was set by some other method (e.g., by pixbuf, stock or gicon).

New in version 2.16.

get_icon_pixbuf(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

A GdkPixbuf.Pixbuf, or None if no icon is set for this position.

Return type:

GdkPixbuf.Pixbuf or None

Retrieves the image used for the icon.

Unlike the other methods of setting and getting icon data, this method will work regardless of whether the icon was set using a GdkPixbuf.Pixbuf, a Gio.Icon, a stock item, or an icon name.

New in version 2.16.

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.

New in version 2.16.

get_icon_stock(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – Icon position

Returns:

A stock id, or None if no icon is set or if the icon wasn’t set from a stock id

Return type:

str

Retrieves the stock id used for the icon, or None if there is no icon or if the icon was set by some other method (e.g., by pixbuf, icon name or gicon).

New in version 2.16.

Deprecated since version 3.10: Use Gtk.Entry.get_icon_name() instead.

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.

New in version 2.16.

get_icon_tooltip_markup(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – the icon position

Returns:

the tooltip text, or None. Free the returned string with GLib.free() when done.

Return type:

str or None

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

New in version 2.16.

get_icon_tooltip_text(icon_pos)[source]
Parameters:

icon_pos (Gtk.EntryIconPosition) – the icon position

Returns:

the tooltip text, or None. Free the returned string with GLib.free() when done.

Return type:

str or None

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

New in version 2.16.

get_inner_border()[source]
Returns:

the entry’s Gtk.Border, or None if none was set.

Return type:

Gtk.Border or None

This function returns the entry’s Gtk.Entry :inner-border property. See Gtk.Entry.set_inner_border() for more information.

New in version 2.10.

Deprecated since version 3.4: Use the standard border and padding CSS properties (through objects like Gtk.StyleContext and Gtk.CssProvider); the value returned by this function is ignored by Gtk.Entry.

get_input_hints()[source]
Return type:

Gtk.InputHints

Gets the value of the Gtk.Entry :input-hints property.

New in version 3.6.

get_input_purpose()[source]
Return type:

Gtk.InputPurpose

Gets the value of the Gtk.Entry :input-purpose property.

New in version 3.6.

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 real characters for entries with visibility set to false. See Gtk.Entry.set_invisible_char().

get_layout()[source]
Returns:

the Pango.Layout for this entry

Return type:

Pango.Layout

Gets the Pango.Layout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with Gtk.Entry.get_layout_offsets(). The returned layout is owned by the entry and must not be modified or freed by the caller.

Keep in mind that the layout text may contain a preedit string, so Gtk.Entry.layout_index_to_text_index() and Gtk.Entry.text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

get_layout_offsets()[source]
Returns:

x:

location to store X offset of layout, or None

y:

location to store Y offset of layout, or None

Return type:

(x: int, y: int)

Obtains the position of the Pango.Layout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

Also useful to convert mouse events into coordinates inside the Pango.Layout, e.g. to take some action if some part of the entry text is clicked.

Note that as the user scrolls around in the entry the offsets will change; you’ll need to connect to the “notify::scroll-offset” signal to track this. Remember when using the Pango.Layout functions you need to convert to and from pixels using PANGO_PIXELS() or Pango.SCALE.

Keep in mind that the layout text may contain a preedit string, so Gtk.Entry.layout_index_to_text_index() and Gtk.Entry.text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

get_max_length()[source]
Returns:

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

Return type:

int

Retrieves the maximum allowed length of the text in self. See Gtk.Entry.set_max_length().

This is equivalent to getting self's Gtk.EntryBuffer and calling Gtk.EntryBuffer.get_max_length() on it.

get_max_width_chars()[source]
Returns:

the maximum width of the entry, in characters

Return type:

int

Retrieves the desired maximum width of self, in characters. See Gtk.Entry.set_max_width_chars().

New in version 3.12.

get_overwrite_mode()[source]
Returns:

whether the text is overwritten when typing.

Return type:

bool

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

New in version 2.14.

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.

Return type:

str

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

New in version 3.2.

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 Gtk.Entry.set_progress_fraction().

New in version 2.16.

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().

New in version 2.16.

get_tabs()[source]
Returns:

the tabstops, or None if none was set.

Return type:

Pango.TabArray or None

Gets the tabstops that were set on the entry using Gtk.Entry.set_tabs(), if any.

New in version 3.10.

get_text()[source]
Returns:

a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.

Return type:

str

Retrieves the contents of the entry widget. See also Gtk.Editable.get_chars().

This is equivalent to getting self's Gtk.EntryBuffer and calling Gtk.EntryBuffer.get_text() on it.

get_text_area()[source]
Returns:

Return location for the text area.

Return type:

text_area: Gdk.Rectangle

Gets the area where the entry’s text is drawn. This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized, text_area is filled with zeros.

See also Gtk.Entry.get_icon_area().

New in version 3.0.

get_text_length()[source]
Returns:

the current number of characters in Gtk.Entry, 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 Gtk.EntryBuffer and calling Gtk.EntryBuffer.get_length() on it.

New in version 2.14.

get_visibility()[source]
Returns:

True if the text is currently visible

Return type:

bool

Retrieves whether the text in self is visible. See Gtk.Entry.set_visibility().

get_width_chars()[source]
Returns:

number of chars to request space for, or negative if unset

Return type:

int

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

grab_focus_without_selecting()[source]

Causes self to have keyboard focus.

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

New in version 3.16.

im_context_filter_keypress(event)[source]
Parameters:

event (Gdk.EventKey) – the key event

Returns:

True if the input method handled the key event.

Return type:

bool

Allow the Gtk.Entry input method to internally handle key press and release events. If this function returns True, then no further processing should be done for this key event. See Gtk.IMContext.filter_keypress().

Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the Gtk.Entry. See Gtk.TextView.reset_im_context() for an example of use.

New in version 2.22.

layout_index_to_text_index(layout_index)[source]
Parameters:

layout_index (int) – byte index into the entry layout text

Returns:

byte index into the entry contents

Return type:

int

Converts from a position in the entry’s Pango.Layout (returned by Gtk.Entry.get_layout()) to a position in the entry contents (returned by Gtk.Entry.get_text()).

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 Gtk.Entry.set_progress_pulse_step()).

New in version 2.16.

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.

New in version 2.22.

set_activates_default(setting)[source]
Parameters:

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

If setting is True, pressing Enter in the self will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.

(For experts: if setting is True, the entry calls Gtk.Window.activate_default() on the window containing the entry, in the default handler for the Gtk.Entry ::activate signal.)

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.

New in version 2.4.

set_attributes(attrs)[source]
Parameters:

attrs (Pango.AttrList) – a Pango.AttrList

Sets a Pango.AttrList; the attributes in the list are applied to the entry text.

New in version 3.6.

set_buffer(buffer)[source]
Parameters:

buffer (Gtk.EntryBuffer) – a Gtk.EntryBuffer

Set the Gtk.EntryBuffer object which holds the text for this widget.

New in version 2.18.

set_completion(completion)[source]
Parameters:

completion (Gtk.EntryCompletion or None) – The Gtk.EntryCompletion or None

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 Gtk.EntryCompletion API. Completion is disabled if completion is set to None.

New in version 2.4.

set_cursor_hadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – an adjustment which should be adjusted when the cursor is moved, or None

Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position. See Gtk.ScrolledWindow.get_hadjustment() for a typical way of obtaining the adjustment.

The adjustment has to be in pixel units and in the same coordinate system as the entry.

New in version 2.12.

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.

New in version 2.16.

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

Sets up the icon at the given position so that GTK+ will start a drag operation when the user clicks and drags the icon.

To handle the drag operation, you need to connect to the usual Gtk.Widget ::drag-data-get (or possibly Gtk.Widget ::drag-data-delete) signal, and use Gtk.Entry.get_current_icon_drag_source() in your signal handler to find out if the drag was started from an icon.

By default, GTK+ uses the icon as the drag icon. You can use the Gtk.Widget ::drag-begin signal to set a different icon. Note that you have to use g_signal_connect_after() to ensure that your signal handler gets executed after the default handler.

New in version 2.16.

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.

New in version 2.16.

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.

New in version 2.16.

set_icon_from_pixbuf(icon_pos, pixbuf)[source]
Parameters:

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

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

New in version 2.16.

set_icon_from_stock(icon_pos, stock_id)[source]
Parameters:

Sets the icon shown in the entry at the specified position from a stock image.

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

New in version 2.16.

Deprecated since version 3.10: Use Gtk.Entry.set_icon_from_icon_name() instead.

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.

New in version 2.16.

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 the Pango text markup language.

Use None for tooltip to remove an existing tooltip.

See also Gtk.Widget.set_tooltip_markup() and Gtk.Entry.set_icon_tooltip_text().

New in version 2.16.

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

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

New in version 2.16.

set_inner_border(border)[source]
Parameters:

border (Gtk.Border or None) – a Gtk.Border, or None

Sets %entry’s inner-border property to border, or clears it if None is passed. The inner-border is the area around the entry’s text, but inside its frame.

If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.

New in version 2.10.

Deprecated since version 3.4: Use the standard border and padding CSS properties (through objects like Gtk.StyleContext and Gtk.CssProvider); the value set with this function is ignored by Gtk.Entry.

set_input_hints(hints)[source]
Parameters:

hints (Gtk.InputHints) – the hints

Sets the Gtk.Entry :input-hints property, which allows input methods to fine-tune their behaviour.

New in version 3.6.

set_input_purpose(purpose)[source]
Parameters:

purpose (Gtk.InputPurpose) – the purpose

Sets the Gtk.Entry :input-purpose property which can be used by on-screen keyboards and other input methods to adjust their behaviour.

New in version 3.6.

set_invisible_char(ch)[source]
Parameters:

ch (str) – a Unicode character

Sets the character to use in place of the actual text when Gtk.Entry.set_visibility() has been called to set text visibility to False. i.e. this is the character used in “password mode” to show the user how many characters have been typed. 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.

This is equivalent to getting self's Gtk.EntryBuffer and calling Gtk.EntryBuffer.set_max_length() on it. ]|

set_max_width_chars(n_chars)[source]
Parameters:

n_chars (int) – the new desired maximum width, in characters

Sets the desired maximum width in characters of self.

New in version 3.12.

set_overwrite_mode(overwrite)[source]
Parameters:

overwrite (bool) – new value

Sets whether the text is overwritten when typing in the Gtk.Entry.

New in version 2.14.

set_placeholder_text(text)[source]
Parameters:

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

Sets text to be displayed in self when it is empty and unfocused. This can be used to give a visual hint of the expected contents of the Gtk.Entry.

Note that since the placeholder text gets removed when the entry received focus, using this feature is a bit problematic if the entry is given the initial focus in a window. Sometimes this can be worked around by delaying the initial focus setting until the first key event arrives.

New in version 3.2.

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.

New in version 2.16.

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 call to Gtk.Entry.progress_pulse().

New in version 2.16.

set_tabs(tabs)[source]
Parameters:

tabs (Pango.TabArray) – a Pango.TabArray

Sets a Pango.TabArray; the tabstops in the array are applied to the entry text.

New in version 3.10.

set_text(text)[source]
Parameters:

text (str) – the new text

Sets the text in the widget to the given value, replacing the current contents.

See Gtk.EntryBuffer.set_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 Gtk.Entry.set_invisible_char().

Note that you probably want to set 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.

set_width_chars(n_chars)[source]
Parameters:

n_chars (int) – width in chars

Changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

text_index_to_layout_index(text_index)[source]
Parameters:

text_index (int) – byte index into the entry contents

Returns:

byte index into the entry layout text

Return type:

int

Converts from a position in the entry contents (returned by Gtk.Entry.get_text()) to a position in the entry’s Pango.Layout (returned by Gtk.Entry.get_layout(), with text retrieved via Pango.Layout.get_text()).

unset_invisible_char()[source]

Unsets the invisible str previously set with Gtk.Entry.set_invisible_char(). So that the default invisible str is used again.

New in version 2.16.

do_activate() virtual

Class handler for the Gtk.Entry ::activate signal. The default implementation calls Gtk.Window.activate_default() on the entry’s top-level window.

do_backspace() virtual

Class handler for the Gtk.Entry ::backspace signal. The default implementation deletes the selection or a single character or word.

do_copy_clipboard() virtual

Class handler for the Gtk.Entry ::copy-clipboard signal. The default implementation copies the selection, if one exists.

do_cut_clipboard() virtual

Class handler for the Gtk.Entry ::cut-clipboard signal. The default implementation cuts the selection, if one exists.

do_delete_from_cursor(type, count) virtual
Parameters:

Class handler for the Gtk.Entry ::delete-from-cursor signal. The default implementation deletes the selection or the specified number of characters or words.

do_get_frame_size(x, y, width, height) virtual
Parameters:

Calculate the size of the text area frame, which is its allocated width and requested height, minus space for margins and borders, and taking baseline and text height into account. This virtual function must be non-None.

do_get_text_area_size(x, y, width, height) virtual
Parameters:

Calculate the size of the text area, which is its allocated width and requested height, minus space for margins and borders. This virtual function must be non-None.

do_insert_at_cursor(str) virtual
Parameters:

str (str) –

Class handler for the Gtk.Entry ::insert-at-cursor signal. The default implementation inserts text at the cursor.

do_insert_emoji() virtual
do_move_cursor(step, count, extend_selection) virtual
Parameters:

Class handler for the Gtk.Entry ::move-cursor signal. The default implementation specifies the standard Gtk.Entry cursor movement behavior.

do_paste_clipboard() virtual

Class handler for the Gtk.Entry ::paste-clipboard signal. The default implementation pastes at the current cursor position or over the current selection if one exists.

do_populate_popup(popup) virtual
Parameters:

popup (Gtk.Widget) –

Class handler for the Gtk.Entry ::populate-popup signal. If non-None, this will be called to add additional entries to the context menu when it is displayed.

do_toggle_overwrite() virtual

Class handler for the Gtk.Entry ::toggle-overwrite signal. The default implementation toggles overwrite mode and blinks the cursor.

Signal Details

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

activate

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::activate signal is emitted when the user hits the Enter key.

While this signal is used as a keybinding signal, it is also commonly used by applications to intercept activation of entries.

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

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

backspace

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::backspace signal is a keybinding signal which gets emitted when the user asks for it.

The default bindings for this signal are Backspace and Shift-Backspace.

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

copy-clipboard

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard.

The default bindings for this signal are Ctrl-c and Ctrl-Insert.

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

cut-clipboard

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::cut-clipboard signal is a keybinding signal which gets emitted to cut the selection to the clipboard.

The default bindings for this signal are Ctrl-x and Shift-Delete.

Gtk.Entry.signals.delete_from_cursor(entry, type, count)
Signal Name:

delete-from-cursor

Flags:

RUN_LAST, ACTION

Parameters:

The ::delete-from-cursor signal is a keybinding signal which gets emitted when the user initiates a text deletion.

If the type is Gtk.DeleteType.CHARS, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters.

The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for deleting a word.

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

icon-press

Flags:

RUN_LAST

Parameters:

The ::icon-press signal is emitted when an activatable icon is clicked.

New in version 2.16.

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

icon-release

Flags:

RUN_LAST

Parameters:

The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon.

New in version 2.16.

Gtk.Entry.signals.insert_at_cursor(entry, string)
Signal Name:

insert-at-cursor

Flags:

RUN_LAST, ACTION

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

  • string (str) – the string to insert

The ::insert-at-cursor signal is a keybinding signal which gets emitted when the user initiates the insertion of a fixed string at the cursor.

This signal has no default bindings.

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

insert-emoji

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::insert-emoji signal is a keybinding signal which gets emitted to present the Emoji chooser for the entry.

The default bindings for this signal are Ctrl-. and Ctrl-;

New in version 3.22.27.

Gtk.Entry.signals.move_cursor(entry, step, count, extend_selection)
Signal Name:

move-cursor

Flags:

RUN_LAST, ACTION

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

  • step (Gtk.MovementStep) – the granularity of the move, as a Gtk.MovementStep

  • count (int) – the number of step units to move

  • extend_selection (bool) – True if the move should extend the selection

The ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement. If the cursor is not visible in entry, this signal causes the viewport to be moved instead.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.

  • Arrow keys move by individual characters/lines

  • Ctrl-arrow key combinations move by words/paragraphs

  • Home/End keys move to the ends of the buffer

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

paste-clipboard

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::paste-clipboard signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view.

The default bindings for this signal are Ctrl-v and Shift-Insert.

Gtk.Entry.signals.populate_popup(entry, widget)
Signal Name:

populate-popup

Flags:

RUN_LAST

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

  • widget (Gtk.Widget) – the container that is being populated

The ::populate-popup signal gets emitted before showing the context menu of the entry.

If you need to add items to the context menu, connect to this signal and append your items to the widget, which will be a Gtk.Menu in this case.

If Gtk.Entry :populate-all is True, this signal will also be emitted to populate touch popups. In this case, widget will be a different container, e.g. a Gtk.Toolbar. The signal handler should not make assumptions about the type of widget.

Gtk.Entry.signals.preedit_changed(entry, preedit)
Signal Name:

preedit-changed

Flags:

RUN_LAST, ACTION

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

  • preedit (str) – the current preedit string

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

New in version 2.20.

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

toggle-overwrite

Flags:

RUN_LAST, ACTION

Parameters:

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

The ::toggle-overwrite signal is a keybinding signal which gets emitted to toggle the overwrite mode of the entry.

The default bindings for this signal is Insert.

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 (such as the default button in a dialog) 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 Pango.Attribute's start_index and end_index must refer to the Gtk.EntryBuffer text, i.e. without the preedit string.

New in version 3.6.

Gtk.Entry.props.buffer
Name:

buffer

Type:

Gtk.EntryBuffer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

Text buffer object which actually stores entry text

Gtk.Entry.props.caps_lock_warning
Name:

caps-lock-warning

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether password entries will show a warning when Caps Lock is on.

Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.

New in version 2.16.

Gtk.Entry.props.completion
Name:

completion

Type:

Gtk.EntryCompletion

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The auxiliary completion object to use with the entry.

New in version 3.2.

Gtk.Entry.props.cursor_position
Name:

cursor-position

Type:

int

Default Value:

0

Flags:

READABLE

The current position of the insertion cursor in chars

Gtk.Entry.props.editable
Name:

editable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the entry contents can be edited

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

Gtk.Entry.props.has_frame
Name:

has-frame

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

False removes outside bevel from entry

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 Gtk.IMContext.

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

New in version 2.16.

Gtk.Entry.props.inner_border
Name:

inner-border

Type:

Gtk.Border

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets the text area’s border between the text and the frame.

New in version 2.10.

Deprecated since version 3.4: Use the standard border and padding CSS properties (through objects like Gtk.StyleContext and Gtk.CssProvider); the value of this style property is ignored.

Gtk.Entry.props.input_hints
Name:

input-hints

Type:

Gtk.InputHints

Default Value:

Gtk.InputHints.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Additional hints (beyond Gtk.Entry :input-purpose) that allow input methods to fine-tune their behaviour.

New in version 3.6.

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 Gtk.Entry :visibility.

New in version 3.6.

Gtk.Entry.props.invisible_char
Name:

invisible-char

Type:

int

Default Value:

42

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The invisible character is used when masking entry contents (in \”password mode\”)”). When it is not explicitly set with the Gtk.Entry :invisible-char property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

This style property allows the theme to prepend a character to the list of candidates.

New in version 2.18.

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 Gtk.Entry.

New in version 2.16.

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. Zero if no maximum

Gtk.Entry.props.max_width_chars
Name:

max-width-chars

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The desired maximum width of the entry, in characters. If this property is set to -1, the width will be calculated automatically.

New in version 3.12.

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 Gtk.Entry.

New in version 2.14.

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 Gtk.Entry when it is empty and unfocused.

New in version 3.2.

Gtk.Entry.props.populate_all
Name:

populate-all

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If :populate-all is True, the Gtk.Entry ::populate-popup signal is also emitted for touch popups.

New in version 3.8.

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 Gtk.Entry ::icon-press and Gtk.Entry ::icon-release signals only on sensitive, activatable icons.

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

New in version 2.16.

Gtk.Entry.props.primary_icon_gicon
Name:

primary-icon-gicon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The Gio.Icon to use for the primary icon for the entry.

New in version 2.16.

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.

New in version 2.16.

Gtk.Entry.props.primary_icon_pixbuf
Name:

primary-icon-pixbuf

Type:

GdkPixbuf.Pixbuf

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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

New in version 2.16.

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 Gtk.Entry ::icon-press and 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.

New in version 2.16.

Gtk.Entry.props.primary_icon_stock
Name:

primary-icon-stock

Type:

str

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The stock id to use for the primary icon for the entry.

New in version 2.16.

Deprecated since version 3.10: Use Gtk.Entry :primary-icon-name instead.

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.

New in version 2.16.

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, which is marked up with the Pango text markup language.

Also see Gtk.Entry.set_icon_tooltip_markup().

New in version 2.16.

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 Gtk.Entry.set_icon_tooltip_text().

New in version 2.16.

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.

New in version 2.16.

Gtk.Entry.props.progress_pulse_step
Name:

progress-pulse-step

Type:

float

Default Value:

0.1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The fraction of total entry width to move the progress bouncing block for each call to Gtk.Entry.progress_pulse().

New in version 2.16.

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 Gtk.Entry ::icon-press and Gtk.Entry ::icon-release signals only on sensitive, activatable icons.

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

New in version 2.16.

Gtk.Entry.props.secondary_icon_gicon
Name:

secondary-icon-gicon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The Gio.Icon to use for the secondary icon for the entry.

New in version 2.16.

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.

New in version 2.16.

Gtk.Entry.props.secondary_icon_pixbuf
Name:

secondary-icon-pixbuf

Type:

GdkPixbuf.Pixbuf

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

An pixbuf to use as the secondary icon for the entry.

New in version 2.16.

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 Gtk.Entry ::icon-press and 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.

New in version 2.16.

Gtk.Entry.props.secondary_icon_stock
Name:

secondary-icon-stock

Type:

str

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The stock id to use for the secondary icon for the entry.

New in version 2.16.

Deprecated since version 3.10: Use Gtk.Entry :secondary-icon-name instead.

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.

New in version 2.16.

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, which is marked up with the Pango text markup language.

Also see Gtk.Entry.set_icon_tooltip_markup().

New in version 2.16.

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 Gtk.Entry.set_icon_tooltip_text().

New in version 2.16.

Gtk.Entry.props.selection_bound
Name:

selection-bound

Type:

int

Default Value:

0

Flags:

READABLE

The position of the opposite end of the selection from the cursor in chars

Gtk.Entry.props.shadow_type
Name:

shadow-type

Type:

Gtk.ShadowType

Default Value:

Gtk.ShadowType.IN

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Which kind of shadow to draw around the entry when Gtk.Entry :has-frame is set to True.

New in version 2.12.

Deprecated since version 3.20: Use CSS to determine the style of the border; the value of this style property is ignored.

Gtk.Entry.props.show_emoji_icon
Name:

show-emoji-icon

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to show an icon for Emoji

Gtk.Entry.props.tabs
Name:

tabs

Type:

Pango.TabArray

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of tabstop locations to apply to the text of the entry

Gtk.Entry.props.text
Name:

text

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The contents of the entry

Gtk.Entry.props.text_length
Name:

text-length

Type:

int

Default Value:

0

Flags:

READABLE

The length of the text in the Gtk.Entry.

New in version 2.14.

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.

New in version 2.10.

Gtk.Entry.props.visibility
Name:

visibility

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

False displays the “invisible str" instead of the actual text (password mode)

Gtk.Entry.props.width_chars
Name:

width-chars

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Number of characters to leave space for in the entry

Gtk.Entry.props.xalign
Name:

xalign

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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

New in version 2.4.