GNOME Python API

References

  • PyGObject Docs
  • GNOME Developer Documentation

Libraries

  • Adw
  • DBus
  • DBusGLib
  • Flatpak
  • GLib
  • GModule
  • GObject
  • Gcr
  • Gdk
  • GdkPixbuf
  • GdkPixdata
  • GdkWayland
  • GdkX11
  • Gio
  • Graphene
  • Gsk
  • Gst
  • GstBase
  • GstCheck
  • GstController
  • GstNet
  • Gtk
    • Classes
      • ATContext
      • AboutDialog
      • ActionBar
      • ActivateAction
      • Adjustment
      • AlertDialog
      • AlternativeTrigger
      • AnyFilter
      • AppChooserButton
      • AppChooserDialog
      • AppChooserWidget
      • Application
      • ApplicationWindow
      • AspectFrame
      • Assistant
      • AssistantPage
      • BinLayout
      • BookmarkList
      • BoolFilter
      • Box
      • BoxLayout
      • Builder
      • Builder.BuilderScope
      • BuilderCScope
      • BuilderListItemFactory
      • Button
      • CClosureExpression
      • Calendar
      • CallbackAction
      • CellArea
      • CellAreaBox
      • CellAreaContext
      • CellRenderer
      • CellRendererAccel
      • CellRendererCombo
      • CellRendererPixbuf
      • CellRendererProgress
      • CellRendererSpin
      • CellRendererSpinner
      • CellRendererText
      • CellRendererToggle
      • CellView
      • CenterBox
      • CenterLayout
      • CheckButton
      • ClosureExpression
      • ColorButton
      • ColorChooserDialog
      • ColorChooserWidget
      • ColorDialog
      • ColorDialogButton
      • ColumnView
      • ColumnViewCell
      • ColumnViewColumn
      • ColumnViewRow
      • ColumnViewSorter
      • ComboBox
      • ComboBoxText
      • ConstantExpression
      • Constraint
      • ConstraintGuide
      • ConstraintLayout
      • ConstraintLayoutChild
      • CssProvider
      • CustomFilter
      • CustomLayout
      • CustomSorter
      • Dialog
      • DirectoryList
      • DragIcon
      • DragSource
      • DrawingArea
      • DropControllerMotion
      • DropDown
      • DropTarget
      • DropTargetAsync
      • EditableLabel
      • EmojiChooser
      • Entry
      • EntryBuffer
      • EntryCompletion
      • EventController
      • EventControllerFocus
      • EventControllerKey
      • EventControllerLegacy
      • EventControllerMotion
      • EventControllerScroll
      • EveryFilter
      • Expander
      • Expression
      • FileChooserDialog
      • FileChooserNative
      • FileChooserWidget
      • FileDialog
      • FileFilter
      • FileLauncher
      • Filter
      • FilterListModel
      • Fixed
      • FixedLayout
      • FixedLayoutChild
      • FlattenListModel
      • FlowBox
      • FlowBoxChild
      • FontButton
      • FontChooserDialog
      • FontChooserWidget
      • FontDialog
      • FontDialogButton
      • Frame
      • GLArea
      • Gesture
      • GestureClick
      • GestureDrag
      • GestureLongPress
      • GesturePan
      • GestureRotate
      • GestureSingle
      • GestureStylus
      • GestureSwipe
      • GestureZoom
      • GraphicsOffload
      • Grid
      • GridLayout
      • GridLayoutChild
      • GridView
      • HeaderBar
      • IMContext
      • IMContextSimple
      • IMMulticontext
      • IconPaintable
      • IconTheme
      • IconView
      • Image
      • InfoBar
      • Inscription
      • KeyvalTrigger
      • Label
      • LayoutChild
      • LayoutManager
      • LevelBar
      • LinkButton
      • ListBase
      • ListBox
      • ListBoxRow
      • ListHeader
      • ListItem
      • ListItemFactory
      • ListStore
      • ListView
      • LockButton
      • MapListModel
      • MediaControls
      • MediaFile
      • MediaStream
      • MenuButton
      • MessageDialog
      • MnemonicAction
      • MnemonicTrigger
      • MountOperation
      • MultiFilter
      • MultiSelection
      • MultiSorter
      • NamedAction
      • NativeDialog
      • NeverTrigger
      • NoSelection
      • Notebook
      • NotebookPage
      • NothingAction
      • NumericSorter
      • ObjectExpression
      • Overlay
      • OverlayLayout
      • OverlayLayoutChild
      • PadController
      • PageSetup
      • PageSetupUnixDialog
      • Paned
      • ParamSpecExpression
      • PasswordEntry
      • PasswordEntryBuffer
      • Picture
      • Popover
      • PopoverMenu
      • PopoverMenuBar
      • PrintContext
      • PrintDialog
      • PrintJob
      • PrintOperation
      • PrintSettings
      • PrintUnixDialog
      • Printer
      • ProgressBar
      • PropertyExpression
      • PyGTKDeprecationWarning
      • Range
      • RecentManager
      • Revealer
      • Scale
      • ScaleButton
      • Scrollbar
      • ScrolledWindow
      • SearchBar
      • SearchEntry
      • SelectionFilterModel
      • Separator
      • Settings
      • Shortcut
      • ShortcutAction
      • ShortcutController
      • ShortcutLabel
      • ShortcutTrigger
      • ShortcutsGroup
      • ShortcutsSection
      • ShortcutsShortcut
      • ShortcutsWindow
      • SignalAction
      • SignalListItemFactory
      • SingleSelection
      • SizeGroup
      • SliceListModel
      • Snapshot
      • SortListModel
      • Sorter
      • SpinButton
      • Spinner
      • Stack
      • StackPage
      • StackSidebar
      • StackSwitcher
      • Statusbar
      • StringFilter
      • StringList
      • StringObject
      • StringSorter
      • StyleContext
      • Switch
      • Template
      • Template.Callback
      • Template.Child
      • Text
      • TextBuffer
      • TextChildAnchor
      • TextMark
      • TextTag
      • TextTagTable
      • TextView
      • ToggleButton
      • Tooltip
      • TreeExpander
      • TreeListModel
      • TreeListRow
      • TreeListRowSorter
      • TreeModelFilter
      • TreeModelRow
      • TreeModelRowIter
      • TreeModelSort
      • TreeSelection
      • TreeStore
      • TreeView
      • TreeViewColumn
      • UriLauncher
      • Video
      • Viewport
      • VolumeButton
      • Widget
      • WidgetPaintable
      • Window
      • WindowControls
      • WindowGroup
      • WindowHandle
    • Interfaces
    • Structures
    • Enums
    • Functions
    • Constants
    • Dependencies
  • GtkSource
  • HarfBuzz
  • Pango
  • PangoCairo
  • PangoFT2
  • PangoFc
  • PangoOT
  • PangoXft
  • Shumate
  • Soup
  • Vte
  • WebKit
  • WebKitWebProcessExtension
  • Xdp
  • XdpGtk4
  • pycairo
GNOME Python API
  • Gtk
  • Classes
  • SearchBar
  • View page source

SearchBar

class SearchBar(**properties: Any)

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

get_child() → Widget | None

Gets the child widget of bar.

get_key_capture_widget() → Widget | None

Gets the widget that bar is capturing key events from.

get_search_mode() → bool

Returns whether the search mode is on or off.

get_show_close_button() → bool

Returns whether the close button is shown.

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 that bar 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 with forward.

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

Properties

class SearchBar
props.child: Widget

The child widget.

props.key_capture_widget: Widget

The key capture widget.

props.search_mode_enabled: bool

Whether the search mode is on and the search bar shown.

props.show_close_button: bool

Whether to show the close button in the search bar.


Built with Sphinx using a theme provided by Read the Docs.
  • SearchBar
    • Constructors
      • SearchBar.new()
    • Methods
      • SearchBar.connect_entry()
      • SearchBar.get_child()
      • SearchBar.get_key_capture_widget()
      • SearchBar.get_search_mode()
      • SearchBar.get_show_close_button()
      • SearchBar.set_child()
      • SearchBar.set_key_capture_widget()
      • SearchBar.set_search_mode()
      • SearchBar.set_show_close_button()
    • Properties
      • SearchBar.props.child
      • SearchBar.props.key_capture_widget
      • SearchBar.props.search_mode_enabled
      • SearchBar.props.show_close_button