:right-sidebar: True Window =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Window(*args, **kwargs) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gtk.AboutDialog`, :class:`~gi.repository.Gtk.ApplicationWindow`, :class:`~gi.repository.Gtk.Assistant`, :class:`~gi.repository.Gtk.Dialog`, :class:`~gi.repository.Gtk.ShortcutsWindow` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Native`, :class:`~gi.repository.Gtk.Root`, :class:`~gi.repository.Gtk.ShortcutManager` A ``GtkWindow`` is a toplevel window which can contain other widgets. .. image:: https://docs.gtk.org/gtk4/window.png Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,...). GtkWindow as GtkBuildable ------------------------- The ``GtkWindow`` implementation of the :obj:`~gi.repository.Gtk.Buildable` interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a ```` element. CSS nodes --------- .. code-block:: :dedent: window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled] ├── ╰── .titlebar [.default-decoration] ``GtkWindow`` has a main CSS node with name window and style class .background. Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also represents window states with the following style classes on the main node: .maximized, .fullscreen, .tiled (when supported, also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom). ``GtkWindow`` subclasses often add their own discriminating style classes, such as .dialog, .popup or .tooltip. Generally, some CSS properties don't make sense on the toplevel window node, such as margins or padding. When client-side decorations without invisible borders are in use (i.e. the .solid-csd style class is added to the main window node), the CSS border of the toplevel window is used for resize drags. In the .csd case, the shadow area outside of the window can be used to resize it. ``GtkWindow`` adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child. Accessibility ------------- Until GTK 4.10, ``GtkWindow`` used the ``GTK_ACCESSIBLE_ROLE_WINDOW`` role. Since GTK 4.12, ``GtkWindow`` uses the ``GTK_ACCESSIBLE_ROLE_APPLICATION`` role. Actions ------- ``GtkWindow`` defines a set of built-in actions: - ``default.activate``: Activate the default widget. - ``window.minimize``: Minimize the window. - ``window.toggle-maximized``: Maximize or restore the window. - ``window.close``: Close the window. Constructors ------------ .. rst-class:: interim-class .. class:: Window :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``GtkWindow``. To get an undecorated window (no window borders), use :obj:`~gi.repository.Gtk.Window.set_decorated`. All top-level windows created by :func:`~gi.repository.Gtk.Window.new` are stored in an internal top-level window list. This list can be obtained from :obj:`~gi.repository.Gtk.Window.list_toplevels`. Due to GTK keeping a reference to the window internally, :func:`~gi.repository.Gtk.Window.new` does not return a reference to the caller. To delete a ``GtkWindow``, call :obj:`~gi.repository.Gtk.Window.destroy`. Methods ------- .. rst-class:: interim-class .. class:: Window :no-index: .. method:: close() -> None Requests that the window is closed. This is similar to what happens when a window manager close button is clicked. This function can be used with close buttons in custom titlebars. .. method:: destroy() -> None Drop the internal reference GTK holds on toplevel windows. .. method:: fullscreen() -> None Asks to place ``window`` in the fullscreen state. Note that you shouldn’t assume the window is definitely fullscreen afterward, because other entities (e.g. the user or window manager) unfullscreen it again, and not all window managers honor requests to fullscreen windows. You can track the result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property, or by listening to notifications of the :obj:`~gi.repository.Gtk.Window.props.fullscreened` property. .. method:: fullscreen_on_monitor(monitor: ~gi.repository.Gdk.Monitor) -> None Asks to place ``window`` in the fullscreen state on the given ``monitor``. Note that you shouldn't assume the window is definitely fullscreen afterward, or that the windowing system allows fullscreen windows on any given monitor. You can track the result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property, or by listening to notifications of the :obj:`~gi.repository.Gtk.Window.props.fullscreened` property. :param monitor: which monitor to go fullscreen on .. method:: get_application() -> ~gi.repository.Gtk.Application | None Gets the ``GtkApplication`` associated with the window. .. method:: get_child() -> ~gi.repository.Gtk.Widget | None Gets the child widget of ``window``. .. method:: get_decorated() -> bool Returns whether the window has been set to have decorations. .. method:: get_default_icon_name() -> str | None Returns the fallback icon name for windows. The returned string is owned by GTK and should not be modified. It is only valid until the next call to :obj:`~gi.repository.Gtk.Window.set_default_icon_name`. .. method:: get_default_size() -> tuple[int, int] Gets the default size of the window. A value of 0 for the width or height indicates that a default size has not been explicitly set for that dimension, so the “natural” size of the window will be used. This function is the recommended way for [saving window state across restarts of applications](https://developer.gnome.org/documentation/tutorials/save-state.html). .. method:: get_default_widget() -> ~gi.repository.Gtk.Widget | None Returns the default widget for ``window``. .. method:: get_deletable() -> bool Returns whether the window has been set to have a close button. .. method:: get_destroy_with_parent() -> bool Returns whether the window will be destroyed with its transient parent. .. method:: get_focus() -> ~gi.repository.Gtk.Widget | None Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then `gtk_widget_has_focus (widget)` will not be :const:`True` for the widget. .. method:: get_focus_visible() -> bool Gets whether “focus rectangles” are supposed to be visible. .. method:: get_group() -> ~gi.repository.Gtk.WindowGroup Returns the group for ``window``. If the window has no group, then the default group is returned. .. method:: get_handle_menubar_accel() -> bool Returns whether this window reacts to F10 key presses by activating a menubar it contains. .. versionadded:: 4.2 .. method:: get_hide_on_close() -> bool Returns whether the window will be hidden when the close button is clicked. .. method:: get_icon_name() -> str | None Returns the name of the themed icon for the window. .. method:: get_mnemonics_visible() -> bool Gets whether mnemonics are supposed to be visible. .. method:: get_modal() -> bool Returns whether the window is modal. .. method:: get_resizable() -> bool Gets the value set by :func:`~gi.repository.Gtk.Window.set_resizable`. .. method:: get_title() -> str | None Retrieves the title of the window. .. method:: get_titlebar() -> ~gi.repository.Gtk.Widget | None Returns the custom titlebar that has been set with :func:`~gi.repository.Gtk.Window.set_titlebar`. .. method:: get_toplevels() -> ~gi.repository.Gio.ListModel Returns a list of all existing toplevel windows. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets or add new ones, be aware that the list of toplevels will change and emit the "items-changed" signal. .. method:: get_transient_for() -> ~gi.repository.Gtk.Window | None Fetches the transient parent for this window. .. method:: has_group() -> bool Returns whether ``window`` has an explicit window group. .. method:: is_active() -> bool Returns whether the window is part of the current active toplevel. The active toplevel is the window receiving keystrokes. The return value is :const:`True` if the window is active toplevel itself. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window. .. method:: is_fullscreen() -> bool Retrieves the current fullscreen state of ``window``. Note that since fullscreening is ultimately handled by the window manager and happens asynchronously to an application request, you shouldn’t assume the return value of this function changing immediately (or at all), as an effect of calling :obj:`~gi.repository.Gtk.Window.fullscreen` or :obj:`~gi.repository.Gtk.Window.unfullscreen`. If the window isn't yet mapped, the value returned will whether the initial requested state is fullscreen. .. method:: is_maximized() -> bool Retrieves the current maximized state of ``window``. Note that since maximization is ultimately handled by the window manager and happens asynchronously to an application request, you shouldn’t assume the return value of this function changing immediately (or at all), as an effect of calling :obj:`~gi.repository.Gtk.Window.maximize` or :obj:`~gi.repository.Gtk.Window.unmaximize`. If the window isn't yet mapped, the value returned will whether the initial requested state is maximized. .. method:: is_suspended() -> bool Retrieves the current suspended state of ``window``. A window being suspended means it's currently not visible to the user, for example by being on a inactive workspace, minimized, obstructed. .. versionadded:: 4.12 .. method:: list_toplevels() -> list[~gi.repository.Gtk.Widget] Returns a list of all existing toplevel windows. The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first, and then unref all the widgets afterwards. .. method:: maximize() -> None Asks to maximize ``window``, so that it fills the screen. Note that you shouldn’t assume the window is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization. It’s permitted to call this function before showing a window, in which case the window will be maximized when it appears onscreen initially. You can track the result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property, or by listening to notifications on the :obj:`~gi.repository.Gtk.Window.props.maximized` property. .. method:: minimize() -> None Asks to minimize the specified ``window``. Note that you shouldn’t assume the window is definitely minimized afterward, because the windowing system might not support this functionality; other entities (e.g. the user or the window manager) could unminimize it again, or there may not be a window manager in which case minimization isn’t possible, etc. It’s permitted to call this function before showing a window, in which case the window will be minimized before it ever appears onscreen. You can track result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property. .. method:: present() -> None Presents a window to the user. This may mean raising the window in the stacking order, unminimizing it, moving it to the current desktop and/or giving it the keyboard focus (possibly dependent on the user’s platform, window manager and preferences). If ``window`` is hidden, this function also makes it visible. .. method:: present_with_time(timestamp: int) -> None Presents a window to the user in response to an user interaction. See :obj:`~gi.repository.Gtk.Window.present` for more details. The timestamp should be gathered when the window was requested to be shown (when clicking a link for example), rather than once the window is ready to be shown. .. deprecated:: 4.14 Use :func:`~gi.repository.Gtk.Window.present` :param timestamp: the timestamp of the user interaction (typically a button or key press event) which triggered this call .. method:: set_application(application: ~gi.repository.Gtk.Application | None = None) -> None Sets or unsets the ``GtkApplication`` associated with the window. The application will be kept alive for at least as long as it has any windows associated with it (see :func:`~gi.repository.Gio.Gio.Application.hold` for a way to keep it alive without windows). Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the ``application`` to :const:`None`. This is equivalent to calling :obj:`~gi.repository.Gtk.Application.remove_window` and/or :obj:`~gi.repository.Gtk.Application.add_window` on the old/new applications as relevant. :param application: a ``GtkApplication``, or :const:`None` to unset .. method:: set_auto_startup_notification(setting: bool) -> None Sets whether the window should request startup notification. By default, after showing the first ``GtkWindow``, GTK calls :obj:`~gi.repository.Gdk.Toplevel.set_startup_id`. Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example. In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification. :param setting: :const:`True` to automatically do startup notification .. method:: set_child(child: ~gi.repository.Gtk.Widget | None = None) -> None Sets the child widget of ``window``. :param child: the child widget .. method:: set_decorated(setting: bool) -> None Sets whether the window should be decorated. By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow GTK to disable these decorations, creating a borderless window. If you set the decorated property to :const:`False` using this function, GTK will do its best to convince the window manager not to decorate the window. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling :obj:`~gi.repository.Gtk.Widget.show`. On Windows, this function always works, since there’s no window manager policy involved. :param setting: :const:`True` to decorate the window .. method:: set_default_icon_name(name: str) -> None Sets an icon to be used as fallback. The fallback icon is used for windows that haven't had :obj:`~gi.repository.Gtk.Window.set_icon_name` called on them. :param name: the name of the themed icon .. method:: set_default_size(width: int, height: int) -> None Sets the default size of a window. The default size of a window is the size that will be used if no other constraints apply. The default size will be updated whenever the window is resized to reflect the new size, unless the window is forced to a size, like when it is maximized or fullscreened. If the window’s minimum size request is larger than the default, the default will be ignored. Setting the default size to a value <= 0 will cause it to be ignored and the natural size request will be used instead. It is possible to do this while the window is showing to "reset" it to its initial size. Unlike :obj:`~gi.repository.Gtk.Widget.set_size_request`, which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the “natural” default size (the size request of the window). If you use this function to reestablish a previously saved window size, note that the appropriate size to save is the one returned by :obj:`~gi.repository.Gtk.Window.get_default_size`. Using the window allocation directly will not work in all circumstances and can lead to growing or shrinking windows. :param width: width in pixels, or -1 to unset the default width :param height: height in pixels, or -1 to unset the default height .. method:: set_default_widget(default_widget: ~gi.repository.Gtk.Widget | None = None) -> None Sets the default widget. The default widget is the widget that is activated when the user presses Enter in a dialog (for example). :param default_widget: widget to be the default to unset the default widget for the toplevel .. method:: set_deletable(setting: bool) -> None Sets whether the window should be deletable. By default, windows have a close button in the window frame. Some window managers allow GTK to disable this button. If you set the deletable property to :const:`False` using this function, GTK will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling :obj:`~gi.repository.Gtk.Widget.show`. On Windows, this function always works, since there’s no window manager policy involved. :param setting: :const:`True` to decorate the window as deletable .. method:: set_destroy_with_parent(setting: bool) -> None If ``setting`` is :const:`True`, then destroying the transient parent of ``window`` will also destroy ``window`` itself. This is useful for dialogs that shouldn’t persist beyond the lifetime of the main window they are associated with, for example. :param setting: whether to destroy ``window`` with its transient parent .. method:: set_display(display: ~gi.repository.Gdk.Display) -> None Sets the ``GdkDisplay`` where the ``window`` is displayed. If the window is already mapped, it will be unmapped, and then remapped on the new display. :param display: a ``GdkDisplay`` .. method:: set_focus(focus: ~gi.repository.Gtk.Widget | None = None) -> None Sets the focus widget. If ``focus`` is not the current focus widget, and is focusable, sets it as the focus widget for the window. If ``focus`` is :const:`None`, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, 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 any focus widget for the toplevel window. .. method:: set_focus_visible(setting: bool) -> None Sets whether “focus rectangles” are supposed to be visible. This property is maintained by GTK based on user input, and should not be set by applications. :param setting: the new value .. method:: set_handle_menubar_accel(handle_menubar_accel: bool) -> None Sets whether this window should react to F10 key presses by activating a menubar it contains. .. versionadded:: 4.2 :param handle_menubar_accel: :const:`True` to make ``window`` handle F10 .. method:: set_hide_on_close(setting: bool) -> None If ``setting`` is :const:`True`, then clicking the close button on the window will not destroy it, but only hide it. :param setting: whether to hide the window when it is closed .. method:: set_icon_name(name: str | None = None) -> None Sets the icon for the window from a named themed icon. See the docs for :obj:`~gi.repository.Gtk.IconTheme` for more details. On some platforms, the window icon is not used at all. Note that this has nothing to do with the WM_ICON_NAME property which is mentioned in the ICCCM. :param name: the name of the themed icon .. method:: set_interactive_debugging(enable: bool) -> None Opens or closes the `interactive debugger `_. The debugger offers access to the widget hierarchy of the application and to useful debugging tools. :param enable: :const:`True` to enable interactive debugging .. method:: set_mnemonics_visible(setting: bool) -> None Sets whether mnemonics are supposed to be visible. This property is maintained by GTK based on user input, and should not be set by applications. :param setting: the new value .. method:: set_modal(modal: bool) -> None Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use :obj:`~gi.repository.Gtk.Window.set_transient_for` to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent. :param modal: whether the window is modal .. method:: set_resizable(resizable: bool) -> None Sets whether the user can resize a window. Windows are user resizable by default. :param resizable: :const:`True` if the user can resize this window .. method:: set_startup_id(startup_id: str) -> None Sets the startup notification ID. Startup notification identifiers are used by desktop environment to track application startup, to provide user feedback and other features. This function changes the corresponding property on the underlying ``GdkSurface``. Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling :obj:`~gi.repository.Gtk.Window.present` or any equivalent function generating a window map event. This function is only useful on X11, not with other GTK targets. :param startup_id: a string with startup-notification identifier .. method:: set_title(title: str | None = None) -> None Sets the title of the ``GtkWindow``. The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager so exactly how the title appears to users may vary according to a user’s exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example. Passing :const:`None` does the same as setting the title to an empty string. :param title: title of the window .. method:: set_titlebar(titlebar: ~gi.repository.Gtk.Widget | None = None) -> None Sets a custom titlebar for ``window``. A typical widget used here is :obj:`~gi.repository.Gtk.HeaderBar`, as it provides various features expected of a titlebar while allowing the addition of child widgets to it. If you set a custom titlebar, GTK will do its best to convince the window manager not to put its own titlebar on the window. Depending on the system, this function may not work for a window that is already visible, so you set the titlebar before calling :obj:`~gi.repository.Gtk.Widget.show`. :param titlebar: the widget to use as titlebar .. method:: set_transient_for(parent: ~gi.repository.Gtk.Window | None = None) -> None Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window. :obj:`~gi.repository.Gtk.Dialog.new_with_buttons` and other convenience functions in GTK will sometimes call :func:`~gi.repository.Gtk.Window.set_transient_for` on your behalf. Passing :const:`None` for ``parent`` unsets the current transient window. On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X. :param parent: parent window .. method:: unfullscreen() -> None Asks to remove the fullscreen state for ``window``, and return to its previous state. Note that you shouldn’t assume the window is definitely not fullscreen afterward, because other entities (e.g. the user or window manager) could fullscreen it again, and not all window managers honor requests to unfullscreen windows; normally the window will end up restored to its normal state. Just don’t write code that crashes if not. You can track the result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property, or by listening to notifications of the :obj:`~gi.repository.Gtk.Window.props.fullscreened` property. .. method:: unmaximize() -> None Asks to unmaximize ``window``. Note that you shouldn’t assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) maximize it again, and not all window managers honor requests to unmaximize. You can track the result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property, or by listening to notifications on the :obj:`~gi.repository.Gtk.Window.props.maximized` property. .. method:: unminimize() -> None Asks to unminimize the specified ``window``. Note that you shouldn’t assume the window is definitely unminimized afterward, because the windowing system might not support this functionality; other entities (e.g. the user or the window manager) could minimize it again, or there may not be a window manager in which case minimization isn’t possible, etc. You can track result of this operation via the :obj:`~gi.repository.Gdk.Toplevel.props.state` property. Properties ---------- .. rst-class:: interim-class .. class:: Window :no-index: .. attribute:: props.application :type: ~gi.repository.Gtk.Application The ``GtkApplication`` associated with the window. The application will be kept alive for at least as long as it has any windows associated with it (see :func:`~gi.repository.Gio.Gio.Application.hold` for a way to keep it alive without windows). Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the :application property to :const:`None`. .. attribute:: props.child :type: ~gi.repository.Gtk.Widget The child widget. .. attribute:: props.decorated :type: bool Whether the window should have a frame (also known as *decorations*). .. attribute:: props.default_height :type: int The default height of the window. .. attribute:: props.default_widget :type: ~gi.repository.Gtk.Widget The default widget. .. attribute:: props.default_width :type: int The default width of the window. .. attribute:: props.deletable :type: bool Whether the window frame should have a close button. .. attribute:: props.destroy_with_parent :type: bool If this window should be destroyed when the parent is destroyed. .. attribute:: props.display :type: ~gi.repository.Gdk.Display The display that will display this window. .. attribute:: props.focus_visible :type: bool Whether 'focus rectangles' are currently visible in this window. This property is maintained by GTK based on user input and should not be set by applications. .. attribute:: props.focus_widget :type: ~gi.repository.Gtk.Widget The focus widget. .. attribute:: props.fullscreened :type: bool Whether the window is fullscreen. Setting this property is the equivalent of calling :obj:`~gi.repository.Gtk.Window.fullscreen` or :obj:`~gi.repository.Gtk.Window.unfullscreen`; either operation is asynchronous, which means you will need to connect to the ::notify signal in order to know whether the operation was successful. .. attribute:: props.handle_menubar_accel :type: bool Whether the window frame should handle F10 for activating menubars. .. versionadded:: 4.2 .. attribute:: props.hide_on_close :type: bool If this window should be hidden when the users clicks the close button. .. attribute:: props.icon_name :type: str Specifies the name of the themed icon to use as the window icon. See :obj:`~gi.repository.Gtk.IconTheme` for more details. .. attribute:: props.is_active :type: bool Whether the toplevel is the currently active window. .. attribute:: props.maximized :type: bool Whether the window is maximized. Setting this property is the equivalent of calling :obj:`~gi.repository.Gtk.Window.maximize` or :obj:`~gi.repository.Gtk.Window.unmaximize`; either operation is asynchronous, which means you will need to connect to the ::notify signal in order to know whether the operation was successful. .. attribute:: props.mnemonics_visible :type: bool Whether mnemonics are currently visible in this window. This property is maintained by GTK based on user input, and should not be set by applications. .. attribute:: props.modal :type: bool If :const:`True`, the window is modal. .. attribute:: props.resizable :type: bool If :const:`True`, users can resize the window. .. attribute:: props.startup_id :type: str A write-only property for setting window's startup notification identifier. .. attribute:: props.suspended :type: bool Whether the window is suspended. See :obj:`~gi.repository.Gtk.Window.is_suspended` for details about what suspended means. .. versionadded:: 4.12 .. attribute:: props.title :type: str The title of the window. .. attribute:: props.titlebar :type: ~gi.repository.Gtk.Widget The titlebar widget. .. versionadded:: 4.6 .. attribute:: props.transient_for :type: ~gi.repository.Gtk.Window The transient parent of the window. Signals ------- .. rst-class:: interim-class .. class:: Window.signals :no-index: .. method:: activate_default() -> None Emitted when the user activates the default widget of ``window``. This is a `keybinding signal `_. .. method:: activate_focus() -> None Emitted when the user activates the currently focused widget of ``window``. This is a `keybinding signal `_. .. method:: close_request() -> bool Emitted when the user clicks on the close button of the window. .. method:: enable_debugging(toggle: bool) -> bool Emitted when the user enables or disables interactive debugging. When ``toggle`` is :const:`True`, interactive debugging is toggled on or off, when it is :const:`False`, the debugger will be pointed at the widget under the pointer. This is a `keybinding signal `_. The default bindings for this signal are Ctrl-Shift-I and Ctrl-Shift-D. :param toggle: toggle the debugger .. method:: keys_changed() -> None emitted when the set of accelerators or mnemonics that are associated with ``window`` changes. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.Shortcut` and :obj:`~gi.repository.Gtk.EventController` to implement keyboard shortcuts Virtual Methods --------------- .. rst-class:: interim-class .. class:: Window :no-index: .. method:: do_activate_default() -> None Activates the default widget for the window. .. method:: do_activate_focus() -> None Activates the current focused widget within the window. .. method:: do_close_request() -> bool Class handler for the ``GtkWindow::close-request`` signal. .. method:: do_enable_debugging(toggle: bool) -> bool Class handler for the ``GtkWindow::enable-debugging`` keybinding signal. :param toggle: .. method:: do_keys_changed() -> None Signal gets emitted when the set of accelerators or mnemonics that are associated with window changes. Fields ------ .. rst-class:: interim-class .. class:: Window :no-index: .. attribute:: parent_instance