SearchEntry

class SearchEntry(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget, Editable

Constructors:

SearchEntry(**properties)
new() -> Gtk.Widget

Constructors

class SearchEntry
classmethod new() Widget

Creates a GtkSearchEntry.

Methods

class SearchEntry
get_input_hints() InputHints

Gets the input purpose for entry.

Added in version 4.14.

get_input_purpose() InputPurpose

Gets the input purpose of entry.

Added in version 4.14.

get_key_capture_widget() Widget | None

Gets the widget that entry is capturing key events from.

get_placeholder_text() str | None

Gets the placeholder text associated with entry.

Added in version 4.10.

get_search_delay() int

Get the delay to be used between the last keypress and the search_changed signal being emitted.

Added in version 4.8.

set_input_hints(hints: InputHints) None

Sets the input hints for entry.

Added in version 4.14.

Parameters:

hints – the new input hints

set_input_purpose(purpose: InputPurpose) None

Sets the input purpose of entry.

Added in version 4.14.

Parameters:

purpose – the new input purpose

set_key_capture_widget(widget: Widget | None = None) None

Sets widget as the widget that entry will capture key events from.

Key events are consumed by the search entry to start or continue a search.

If the entry is part of a GtkSearchBar, it is preferable to call set_key_capture_widget instead, which will reveal the entry in addition to triggering the search entry.

Note that despite the name of this function, the events are only ‘captured’ in the bubble phase, which means that editable child widgets of widget will receive text input before it gets captured. If that is not desired, you can capture and forward the events yourself with forward.

Parameters:

widget – a GtkWidget

set_placeholder_text(text: str | None = None) None

Sets the placeholder text associated with entry.

Added in version 4.10.

Parameters:

text – the text to set as a placeholder

set_search_delay(delay: int) None

Set the delay to be used between the last keypress and the search_changed signal being emitted.

Added in version 4.8.

Parameters:

delay – a delay in milliseconds

Properties

class SearchEntry
props.activates_default: bool

Whether to activate the default widget when Enter is pressed.

props.input_hints: InputHints

The hints about input for the GtkSearchEntry used to alter the behaviour of input methods.

Added in version 4.14.

props.input_purpose: InputPurpose

The purpose for the GtkSearchEntry input used to alter the behaviour of input methods.

Added in version 4.14.

props.placeholder_text: str

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

props.search_delay: int

The delay in milliseconds from last keypress to the search changed signal.

Added in version 4.8.

Signals

class SearchEntry.signals
activate() None

Emitted when the entry is activated.

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

next_match() None

Emitted when the user initiates a move to the next match for the current search string.

This is a keybinding signal.

Applications should connect to it, to implement moving between matches.

The default bindings for this signal is Ctrl-g.

previous_match() None

Emitted when the user initiates a move to the previous match for the current search string.

This is a keybinding signal.

Applications should connect to it, to implement moving between matches.

The default bindings for this signal is Ctrl-Shift-g.

search_changed() None

Emitted with a delay. The length of the delay can be changed with the search_delay property.

search_started() None

Emitted when the user initiated a search on the entry.

Emitted when the user stops a search via keyboard input.

This is a keybinding signal.

Applications should connect to it, to implement hiding the search entry in this case.

The default bindings for this signal is Escape.