SearchBar
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
- Constructors:
SearchBar(**properties)
new() -> Gtk.Widget
Constructors
- class SearchBar
- classmethod new() Widget
Creates a
GtkSearchBar
.You will need to tell it about which widget is going to be your text entry using
connect_entry
.
Methods
- class SearchBar
- connect_entry(entry: Editable) None
Connects the
GtkEditable
widget passed as the one to be used in this search bar.The entry should be a descendant of the search bar. Calling this function manually is only required if the entry isn’t the direct child of the search bar (as in our main example).
- Parameters:
entry – a
GtkEditable
- set_child(child: Widget | None = None) None
Sets the child widget of
bar
.- Parameters:
child – the child widget
- set_key_capture_widget(widget: Widget | None = None) None
Sets
widget
as the widget thatbar
will capture key events from.If key events are handled by the search bar, the bar will be shown, and the entry populated with the entered text.
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 withforward
.- Parameters:
widget – a
GtkWidget
- set_search_mode(search_mode: bool) None
Switches the search mode on or off.
- Parameters:
search_mode – the new state of the search mode
- set_show_close_button(visible: bool) None
Shows or hides the close button.
Applications that already have a “search” toggle button should not show a close button in their search bar, as it duplicates the role of the toggle button.
- Parameters:
visible – whether the close button will be shown or not