It is primarily meant to provide context-dependent information
or options. Popovers are attached to a parent widget. By default,
they point to the whole widget area, although this behavior can be
changed with gtk.popover.Popover.setPointingTo.
By default, gtk.popover.Popover performs a grab, in order to ensure input
events get redirected to it while it is shown, and also so the popover
is dismissed in the expected situations (clicks outside the popover,
or the Escape key being pressed). If no such modal behavior is desired
on a popover, gtk.popover.Popover.setAutohide may be called on it to
tweak its behavior.
gtk.popover.Popover has a main node with name popover, an arrow with name arrow,
and another node for the content named contents. The popover node always
gets the .background style class. It also gets the .menu style class
if the popover is menu-like, e.g. is a gtk.popover_menu.PopoverMenu.
When styling a popover directly, the popover node should usually
not have any background. The visible part of the popover can have
a shadow. To specify it in CSS, set the box-shadow of the contents node.
Note that, in order to accomplish appropriate arrow visuals, gtk.popover.Popover
uses custom drawing for the arrow node. This makes it possible for the
arrow to change its shape dynamically, but it also limits the possibilities
of styling it using CSS. In particular, the arrow gets drawn over the
content node's border and shadow, so they look like one shape, which
means that the border width of the content node and the arrow node should
be the same. The arrow also does not support any border shape other than
solid, no border-radius, only one border width (border-bottom-width is
used) and no box-shadow.
gtk.popover.Popover is a bubble-like context popup.
It is primarily meant to provide context-dependent information or options. Popovers are attached to a parent widget. By default, they point to the whole widget area, although this behavior can be changed with gtk.popover.Popover.setPointingTo.
The position of a popover relative to the widget it is attached to can also be changed with gtk.popover.Popover.setPosition
By default, gtk.popover.Popover performs a grab, in order to ensure input events get redirected to it while it is shown, and also so the popover is dismissed in the expected situations (clicks outside the popover, or the Escape key being pressed). If no such modal behavior is desired on a popover, gtk.popover.Popover.setAutohide may be called on it to tweak its behavior.
GtkPopover as menu replacement
gtk.popover.Popover is often used to replace menus. The best was to do this is to use the gtk.popover_menu.PopoverMenu subclass which supports being populated from a gio.menu_model.MenuModel with gtk.popover_menu.PopoverMenu.newFromModel.
CSS nodes
gtk.popover.Popover has a main node with name popover, an arrow with name arrow, and another node for the content named contents. The popover node always gets the .background style class. It also gets the .menu style class if the popover is menu-like, e.g. is a gtk.popover_menu.PopoverMenu.
Particular uses of gtk.popover.Popover, such as touch selection popups or magnifiers in gtk.entry.Entry or gtk.text_view.TextView get style classes like .touch-selection or .magnifier to differentiate from plain popovers.
When styling a popover directly, the popover node should usually not have any background. The visible part of the popover can have a shadow. To specify it in CSS, set the box-shadow of the contents node.
Note that, in order to accomplish appropriate arrow visuals, gtk.popover.Popover uses custom drawing for the arrow node. This makes it possible for the arrow to change its shape dynamically, but it also limits the possibilities of styling it using CSS. In particular, the arrow gets drawn over the content node's border and shadow, so they look like one shape, which means that the border width of the content node and the arrow node should be the same. The arrow also does not support any border shape other than solid, no border-radius, only one border width (border-bottom-width is used) and no box-shadow.