Skip to main content
Ctrl+K

GNOME Python API

  • GLib
  • Gio
  • GObject
  • Gtk
  • Gdk
  • Adw
    • DBus
    • DBusGLib
    • Flatpak
    • GModule
    • Gcr
    • GdkPixbuf
    • GdkPixdata
    • GdkWayland
    • GdkX11
    • Graphene
    • Gsk
    • Gst
    • GstBase
    • GstCheck
    • GstController
    • GstNet
    • GtkSource
    • HarfBuzz
    • ICal
    • JavaScriptCore
    • Pango
    • PangoCairo
    • PangoFT2
    • PangoFc
    • PangoOT
    • PangoXft
    • Shumate
    • Soup
    • Vte
    • WebKit
    • WebKitWebProcessExtension
    • Xdp
    • XdpGtk4
    • pycairo
  • GLib
  • Gio
  • GObject
  • Gtk
  • Gdk
  • Adw
  • DBus
  • DBusGLib
  • Flatpak
  • GModule
  • Gcr
  • GdkPixbuf
  • GdkPixdata
  • GdkWayland
  • GdkX11
  • Graphene
  • Gsk
  • Gst
  • GstBase
  • GstCheck
  • GstController
  • GstNet
  • GtkSource
  • HarfBuzz
  • ICal
  • JavaScriptCore
  • Pango
  • PangoCairo
  • PangoFT2
  • PangoFc
  • PangoOT
  • PangoXft
  • Shumate
  • Soup
  • Vte
  • WebKit
  • WebKitWebProcessExtension
  • Xdp
  • XdpGtk4
  • pycairo

Section Navigation

API

  • Classes
    • AppLaunchContext
    • ButtonEvent
    • CairoContext
    • CicpParams
    • Clipboard
    • ContentDeserializer
    • ContentProvider
    • ContentSerializer
    • CrossingEvent
    • Cursor
    • DNDEvent
    • DeleteEvent
    • Device
    • DeviceTool
    • Display
    • DisplayManager
    • DmabufTexture
    • DmabufTextureBuilder
    • Drag
    • DrawContext
    • Drop
    • Event
    • FocusEvent
    • FrameClock
    • GLContext
    • GLTexture
    • GLTextureBuilder
    • GrabBrokenEvent
    • KeyEvent
    • MemoryTexture
    • MemoryTextureBuilder
    • Monitor
    • MotionEvent
    • PadEvent
    • ProximityEvent
    • ScrollEvent
    • Seat
    • Snapshot
    • Surface
    • Texture
    • TouchEvent
    • TouchpadEvent
    • VulkanContext
  • Interfaces
    • DevicePad
    • DragSurface
    • Paintable
    • Popup
    • Toplevel
  • Structures
    • ColorState
    • ContentFormats
    • ContentFormatsBuilder
    • DmabufFormats
    • DragSurfaceSize
    • EventSequence
    • FileList
    • FrameTimings
    • KeymapKey
    • PopupLayout
    • RGBA
    • Rectangle
    • TextureDownloader
    • TimeCoord
    • ToplevelLayout
    • ToplevelSize
  • Enums
    • AnchorHints
    • AxisFlags
    • AxisUse
    • CicpRange
    • CrossingMode
    • DevicePadFeature
    • DeviceToolType
    • DmabufError
    • DragAction
    • DragCancelReason
    • EventType
    • FrameClockPhase
    • FullscreenMode
    • GLAPI
    • GLError
    • Gravity
    • InputSource
    • KeyMatch
    • MemoryFormat
    • ModifierType
    • NotifyType
    • PaintableFlags
    • ScrollDirection
    • ScrollUnit
    • SeatCapabilities
    • SubpixelLayout
    • SurfaceEdge
    • TextureError
    • TitlebarGesture
    • ToplevelState
    • TouchpadGesturePhase
    • VulkanError
  • Functions
  • Constants
  • Gdk
  • Interfaces
  • Popup

Popup#

class Popup(*args, **kwargs)#

A GdkPopup is a surface that is attached to another surface.

The GdkPopup is positioned relative to its parent surface.

GdkPopups are typically used to implement menus and similar popups. They can be modal, which is indicated by the autohide property.

Methods#

class Popup
get_autohide() → bool#

Returns whether this popup is set to hide on outside clicks.

get_parent() → Surface | None#

Returns the parent surface of a popup.

get_position_x() → int#

Obtains the position of the popup relative to its parent.

get_position_y() → int#

Obtains the position of the popup relative to its parent.

get_rect_anchor() → Gravity#

Gets the current popup rectangle anchor.

The value returned may change after calling present, or after the layout signal is emitted.

get_surface_anchor() → Gravity#

Gets the current popup surface anchor.

The value returned may change after calling present, or after the layout signal is emitted.

present(width: int, height: int, layout: PopupLayout) → bool#

Present popup after having processed the GdkPopupLayout rules.

If the popup was previously not showing, it will be shown, otherwise it will change position according to layout.

After calling this function, the result should be handled in response to the layout signal being emitted. The resulting popup position can be queried using get_position_x, get_position_y, and the resulting size will be sent as parameters in the layout signal. Use get_rect_anchor and get_surface_anchor to get the resulting anchors.

Presenting may fail, for example if the popup is set to autohide and is immediately hidden upon being presented. If presenting failed, the layout signal will not me emitted.

Parameters:
  • width – the unconstrained popup width to layout

  • height – the unconstrained popup height to layout

  • layout – the GdkPopupLayout object used to layout

Properties#

class Popup
props.autohide: bool#

The type of the None singleton.

props.parent: Surface#

The type of the None singleton.

On this page
  • Methods
    • Popup.get_autohide()
    • Popup.get_parent()
    • Popup.get_position_x()
    • Popup.get_position_y()
    • Popup.get_rect_anchor()
    • Popup.get_surface_anchor()
    • Popup.present()
  • Properties
    • Popup.props.autohide
    • Popup.props.parent

This Page

  • Show Source

Created using Sphinx 8.2.3.

General Index

Built with the PyData Sphinx Theme 0.16.1.