:right-sidebar: True Root =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Root(*args, **kwargs) :no-contents-entry: Implementations: :class:`~gi.repository.Gtk.AboutDialog`, :class:`~gi.repository.Gtk.AppChooserDialog`, :class:`~gi.repository.Gtk.ApplicationWindow`, :class:`~gi.repository.Gtk.Assistant`, :class:`~gi.repository.Gtk.ColorChooserDialog`, :class:`~gi.repository.Gtk.Dialog`, :class:`~gi.repository.Gtk.DragIcon`, :class:`~gi.repository.Gtk.FileChooserDialog`, :class:`~gi.repository.Gtk.FontChooserDialog`, :class:`~gi.repository.Gtk.MessageDialog`, :class:`~gi.repository.Gtk.PageSetupUnixDialog`, :class:`~gi.repository.Gtk.PrintUnixDialog`, :class:`~gi.repository.Gtk.ShortcutsWindow`, :class:`~gi.repository.Gtk.Window` ``GtkRoot`` is the interface implemented by all widgets that can act as a toplevel widget. The root widget takes care of providing the connection to the windowing system and manages layout, drawing and event delivery for its widget hierarchy. The obvious example of a ``GtkRoot`` is ``GtkWindow``. To get the display to which a ``GtkRoot`` belongs, use :obj:`~gi.repository.Gtk.Root.get_display`. ``GtkRoot`` also maintains the location of keyboard focus inside its widget hierarchy, with :obj:`~gi.repository.Gtk.Root.set_focus` and :obj:`~gi.repository.Gtk.Root.get_focus`. Methods ------- .. rst-class:: interim-class .. class:: Root :no-index: .. method:: get_display() -> ~gi.repository.Gdk.Display Returns the display that this ``GtkRoot`` is on. .. method:: get_focus() -> ~gi.repository.Gtk.Widget | None Retrieves the current focused widget within the root. Note that this is the widget that would have the focus if the root is active; if the root is not focused then `gtk_widget_has_focus (widget)` will be :const:`False` for the widget. .. method:: set_focus(focus: ~gi.repository.Gtk.Widget | None = None) -> None If ``focus`` is not the current focus widget, and is focusable, sets it as the focus widget for the root. If ``focus`` is :const:`None`, unsets the focus widget for the root. To set the focus to a particular widget in the root, it is usually more convenient to use :obj:`~gi.repository.Gtk.Widget.grab_focus` instead of this function. :param focus: widget to be the new focus widget, or :const:`None` to unset the focus widget