Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
47 lines (32 sloc) 1.28 KB
Popovers
========
The :class:`Gtk.Popover` is a separate window used for displaying additional
information and is often used with button menus and context menus.
Popovers are visually connected to a related widget with a small triangle.
Their uses are similar to those of dialog windows with the advantage of being less
disruptive and having a connection with the widget the popover is pointing to.
A Popover can be created with :class:`Gtk.Popover`; for opening the popover use
:meth:`Gtk.Popover.popup`.
Custom Popover
--------------
A widget can be added to a popover using :meth:`Gtk.Container.add`.
Example
^^^^^^^
.. image:: ../images/popover_example.png
.. literalinclude:: ../examples/popover_example.py
:linenos:
Menu Popover
------------
A popover can be created from a :class:`Gio.MenuModel` using
:meth:`Gtk.Popover.new_from_model` and can be changed after creation with
:meth:`Gtk.Popover.bind_model`.
Passing a :class:`Gio.MenuModel` as a
:data:`menu_model <Gtk.MenuButton.props.menu_model>` argument to the
:class:`Gtk.MenuButton` constructor implicitly creates a popover.
Example
^^^^^^^
.. image:: ../images/popover_advanced_example.png
.. literalinclude:: ../examples/popover_advanced_example.py
See Also
--------
- https://developer.gnome.org/hig/stable/popovers.html.en