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
  • DropDown
  • View page source

DropDown

class DropDown(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

Constructors:

DropDown(**properties)
new(model:Gio.ListModel=None, expression:Gtk.Expression=None) -> Gtk.Widget
new_from_strings(strings:list) -> Gtk.Widget

Constructors

class DropDown
classmethod new(model: ListModel | None = None, expression: Expression | None = None) → Widget

Creates a new GtkDropDown.

You may want to call set_factory to set up a way to map its items to widgets.

Parameters:
  • model – the model to use

  • expression – the expression to use

classmethod new_from_strings(strings: Sequence[str]) → Widget

Creates a new GtkDropDown that is populated with the strings.

Parameters:

strings – The strings to put in the dropdown

Methods

class DropDown
get_enable_search() → bool

Returns whether search is enabled.

get_expression() → Expression | None

Gets the expression set that is used to obtain strings from items.

See set_expression.

get_factory() → ListItemFactory | None

Gets the factory that’s currently used to populate list items.

The factory returned by this function is always used for the item in the button. It is also used for items in the popup if list_factory is not set.

get_header_factory() → ListItemFactory | None

Gets the factory that’s currently used to create header widgets for the popup.

Added in version 4.12.

get_list_factory() → ListItemFactory | None

Gets the factory that’s currently used to populate list items in the popup.

get_model() → ListModel | None

Gets the model that provides the displayed items.

get_search_match_mode() → StringFilterMatchMode

Returns the match mode that the search filter is using.

Added in version 4.12.

get_selected() → int

Gets the position of the selected item.

get_selected_item() → Object | None

Gets the selected item. If no item is selected, None is returned.

get_show_arrow() → bool

Returns whether to show an arrow within the widget.

Added in version 4.6.

set_enable_search(enable_search: bool) → None

Sets whether a search entry will be shown in the popup that allows to search for items in the list.

Note that expression must be set for search to work.

Parameters:

enable_search – whether to enable search

set_expression(expression: Expression | None = None) → None

Sets the expression that gets evaluated to obtain strings from items.

This is used for search in the popup. The expression must have a value type of str.

Parameters:

expression – a GtkExpression

set_factory(factory: ListItemFactory | None = None) → None

Sets the GtkListItemFactory to use for populating list items.

Parameters:

factory – the factory to use

set_header_factory(factory: ListItemFactory | None = None) → None

Sets the GtkListItemFactory to use for creating header widgets for the popup.

Added in version 4.12.

Parameters:

factory – the factory to use

set_list_factory(factory: ListItemFactory | None = None) → None

Sets the GtkListItemFactory to use for populating list items in the popup.

Parameters:

factory – the factory to use

set_model(model: ListModel | None = None) → None

Sets the GListModel to use.

Parameters:

model – the model to use

set_search_match_mode(search_match_mode: StringFilterMatchMode) → None

Sets the match mode for the search filter.

Added in version 4.12.

Parameters:

search_match_mode – the new match mode

set_selected(position: int) → None

Selects the item at the given position.

Parameters:

position – the position of the item to select, or INVALID_LIST_POSITION

set_show_arrow(show_arrow: bool) → None

Sets whether an arrow will be displayed within the widget.

Added in version 4.6.

Parameters:

show_arrow – whether to show an arrow within the widget

Properties

class DropDown
props.enable_search: bool

Whether to show a search entry in the popup.

Note that search requires expression to be set.

props.expression: Expression

An expression to evaluate to obtain strings to match against the search term.

See enable_search for how to enable search. If factory is not set, the expression is also used to bind strings to labels produced by a default factory.

props.factory: ListItemFactory

Factory for populating list items.

props.header_factory: ListItemFactory

The factory for creating header widgets for the popup.

Added in version 4.12.

props.list_factory: ListItemFactory

The factory for populating list items in the popup.

If this is not set, factory is used.

props.model: ListModel

Model for the displayed items.

props.search_match_mode: StringFilterMatchMode

The match mode for the search filter.

Added in version 4.12.

props.selected: int

The position of the selected item.

If no item is selected, the property has the value INVALID_LIST_POSITION.

props.selected_item: Object

The selected item.

props.show_arrow: bool

Whether to show an arrow within the GtkDropDown widget.

Added in version 4.6.

Signals

class DropDown.signals
activate() → None

Emitted to when the drop down is activated.

The ::activate signal on GtkDropDown is an action signal and emitting it causes the drop down to pop up its dropdown.

Added in version 4.6.


Built with Sphinx using a theme provided by Read the Docs.
  • DropDown
    • Constructors
      • DropDown.new()
      • DropDown.new_from_strings()
    • Methods
      • DropDown.get_enable_search()
      • DropDown.get_expression()
      • DropDown.get_factory()
      • DropDown.get_header_factory()
      • DropDown.get_list_factory()
      • DropDown.get_model()
      • DropDown.get_search_match_mode()
      • DropDown.get_selected()
      • DropDown.get_selected_item()
      • DropDown.get_show_arrow()
      • DropDown.set_enable_search()
      • DropDown.set_expression()
      • DropDown.set_factory()
      • DropDown.set_header_factory()
      • DropDown.set_list_factory()
      • DropDown.set_model()
      • DropDown.set_search_match_mode()
      • DropDown.set_selected()
      • DropDown.set_show_arrow()
    • Properties
      • DropDown.props.enable_search
      • DropDown.props.expression
      • DropDown.props.factory
      • DropDown.props.header_factory
      • DropDown.props.list_factory
      • DropDown.props.model
      • DropDown.props.search_match_mode
      • DropDown.props.selected
      • DropDown.props.selected_item
      • DropDown.props.show_arrow
    • Signals
      • DropDown.signals.activate()