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.
GdkPopup
’s are typically used to implement menus and similar popups.
They can be modal, which is indicated by the autohide
property.
Methods
- class Popup
-
- get_rect_anchor() Gravity
Gets the current popup rectangle anchor.
The value returned may change after calling
present
, or after thelayout
signal is emitted.
- get_surface_anchor() Gravity
Gets the current popup surface anchor.
The value returned may change after calling
present
, or after thelayout
signal is emitted.
- present(width: int, height: int, layout: PopupLayout) bool
Present
popup
after having processed theGdkPopupLayout
rules.If the popup was previously now showing, it will be showed, 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 usingget_position_x
,get_position_y
, and the resulting size will be sent as parameters in the layout signal. Useget_rect_anchor
andget_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, thelayout
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