gtk.search_bar
Module for [SearchBar] class
Types 3
gtk.search_bar.SearchBar is a container made to have a search entry.
It can also contain additional widgets, such as drop-down menus, or buttons. The search bar would appear when a search is started through typing on the keyboard, or the application’s search mode is toggled on.
For keyboard presses to start a search, the search bar must be told of a widget to capture key events from through gtk.search_bar.SearchBar.setKeyCaptureWidget. This widget will typically be the top-level window, or a parent container of the search bar. Common shortcuts such as Ctrl+F should be handled as an application action, or through the menu items.
You will also need to tell the search bar about which entry you are using as your search entry using gtk.search_bar.SearchBar.connectEntry.
Creating a search bar
The following example shows you how to create a more complex search entry.
CSS nodes
searchbar
╰── revealer
╰── box
├── [child]
╰── [button.close]gtk.search_bar.SearchBar has a main CSS node with name searchbar. It has a child node with name revealer that contains a node with name box. The box node contains both the CSS node of the child widget as well as an optional button node which gets the .close style class applied.
Accessibility
gtk.search_bar.SearchBar uses the gtk.types.AccessibleRole.Search role.
SearchBarGidBuilder builder() static nothrowGet builder for [gtk.search_bar.SearchBar] Returns: New builder objectvoid child(gtk.widget.Widget propval) @property nothrowSet `child` property. Params: propval = The child widget.gtk.widget.Widget keyCaptureWidget() @property nothrowGet `keyCaptureWidget` property. Returns: The key capture widget.void keyCaptureWidget(gtk.widget.Widget propval) @property nothrowSet `keyCaptureWidget` property. Params: propval = The key capture widget.bool searchModeEnabled() @property nothrowGet `searchModeEnabled` property. Returns: Whether the search mode is on and the search bar shown.void searchModeEnabled(bool propval) @property nothrowSet `searchModeEnabled` property. Params: propval = Whether the search mode is on and the search bar shown.bool showCloseButton() @property nothrowGet `showCloseButton` property. Returns: Whether to show the close button in the search bar.void showCloseButton(bool propval) @property nothrowSet `showCloseButton` property. Params: propval = Whether to show the close button in the search bar.void connectEntry(gtk.editable.Editable entry) nothrowConnects the [gtk.editable.Editable] widget passed as the one to be used in this search bar.gtk.widget.Widget getKeyCaptureWidget() nothrowGets the widget that bar is capturing key events from. Returns: The key capture widget.bool getSearchMode() nothrowReturns whether the search mode is on or off. Returns: whether search mode is toggled onbool getShowCloseButton() nothrowReturns whether the close button is shown. Returns: whether the close button is shownvoid setKeyCaptureWidget(gtk.widget.Widget widget = null) nothrowSets widget as the widget that bar will capture key events from.Fluent builder implementation template for gtk.search_bar.SearchBar
T child(gtk.widget.Widget propval) nothrowSet `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chainingT keyCaptureWidget(gtk.widget.Widget propval) nothrowSet `keyCaptureWidget` property. Params: propval = The key capture widget. Returns: Builder instance for fluent chainingT searchModeEnabled(bool propval) nothrowSet `searchModeEnabled` property. Params: propval = Whether the search mode is on and the search bar shown. Returns: Builder instance for fluent chainingT showCloseButton(bool propval) nothrowSet `showCloseButton` property. Params: propval = Whether to show the close button in the search bar. Returns: Builder instance for fluent chainingFluent builder for gtk.search_bar.SearchBar