Gtk.Window¶
Example¶
 
| Subclasses: | Gtk.ApplicationWindow,Gtk.Assistant,Gtk.Dialog,Gtk.OffscreenWindow,Gtk.Plug,Gtk.ShortcutsWindow | 
|---|
Methods¶
| Inherited: | Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10) | 
|---|---|
| Structs: | Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
Virtual Methods¶
| Inherited: | Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10) | 
|---|
| do_activate_default() | |
| do_activate_focus() | |
| do_enable_debugging(toggle) | |
| do_keys_changed() | |
| do_set_focus(focus) | 
Properties¶
| Inherited: | Gtk.Container (3), Gtk.Widget (39) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| accept-focus | bool | r/w/en | Trueif the window should receive the input focus. | 
| application | Gtk.Application | r/w/en | The Gtk.Applicationfor the window | 
| attached-to | Gtk.Widget | r/w/c/en | The widget where the window is attached | 
| decorated | bool | r/w/en | Whether the window should be decorated by the window manager | 
| default-height | int | r/w/en | The default height of the window, used when initially showing the window | 
| default-width | int | r/w/en | The default width of the window, used when initially showing the window | 
| deletable | bool | r/w/en | Whether the window frame should have a close button | 
| destroy-with-parent | bool | r/w/en | If this window should be destroyed when the parent is destroyed | 
| focus-on-map | bool | r/w/en | Trueif the window should receive the input focus when mapped. | 
| focus-visible | bool | r/w/en | Whether focus rectangles are currently visible in this window | 
| gravity | Gdk.Gravity | r/w/en | The window gravity of the window | 
| has-resize-grip | bool | d/r/w/en | Specifies whether the window should have a resize grip deprecated | 
| has-toplevel-focus | bool | r | Whether the input focus is within this Gtk.Window | 
| hide-titlebar-when-maximized | bool | r/w/en | If this window’s titlebar should be hidden when the window is maximized | 
| icon | GdkPixbuf.Pixbuf | r/w/en | Icon for this window | 
| icon-name | str | r/w/en | Name of the themed icon for this window | 
| is-active | bool | r | Whether the toplevel is the current active window | 
| is-maximized | bool | r | Whether the window is maximized | 
| mnemonics-visible | bool | r/w/en | Whether mnemonics are currently visible in this window | 
| modal | bool | r/w/en | If True, the window is modal (other windows are not usable while this one is up) | 
| resizable | bool | r/w/en | If True, users can resize the window | 
| resize-grip-visible | bool | d/r | Specifies whether the window’s resize grip is visible. deprecated | 
| role | str | r/w | Unique identifier for the window to be used when restoring a session | 
| screen | Gdk.Screen | r/w/en | The screen where this window will be displayed | 
| skip-pager-hint | bool | r/w/en | Trueif the window should not be in the pager. | 
| skip-taskbar-hint | bool | r/w/en | Trueif the window should not be in the task bar. | 
| startup-id | str | w | Unique startup identifier for the window used by startup-notification | 
| title | str | r/w | The title of the window | 
| transient-for | Gtk.Window | r/w/c/en | The transient parent of the dialog | 
| type | Gtk.WindowType | r/w/co | The type of the window | 
| type-hint | Gdk.WindowTypeHint | r/w/en | Hint to help the desktop environment understand what kind of window this is and how to treat it. | 
| urgency-hint | bool | r/w/en | Trueif the window should be brought to the user’s attention. | 
| window-position | Gtk.WindowPosition | r/w/en | The initial position of the window | 
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| decoration-button-layout | str | 'menu:close' | d/r | Decorated button layout deprecated | 
| decoration-resize-handle | int | 20 | r/w | Decoration resize handle size | 
Signals¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| activate-default | The ::activate-defaultsignal is akeybinding signalwhich gets emitted when the user activates the default widget of window. | 
| activate-focus | The ::activate-focussignal is akeybinding signalwhich gets emitted when the user activates the currently focused widget of window. | 
| enable-debugging | The ::enable-debuggingsignal is akeybinding signalwhich gets emitted when the user enables or disables interactive debugging. | 
| keys-changed | The ::keys-changedsignal gets emitted when the set of accelerators or mnemonics that are associated with window changes. | 
| set-focus | This signal is emitted whenever the currently focused widget in this window changes. | 
Fields¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| bin | Gtk.Bin | r | 
Class Details¶
- 
class Gtk.Window(*args, **kwargs)¶
- Bases: - Gtk.Bin- Abstract: - No - Structure: - Gtk.WindowClass- A - Gtk.Windowis a toplevel window which can contain other widgets. 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,…).- The - Gtk.Windowimplementation of the- Gtk.Buildableinterface supports a custom <accel-groups> element, which supports any number of <group> elements representing the- Gtk.AccelGroupobjects you want to add to your window (synonymous with- Gtk.Window.add_accel_group().- It also supports the <initial-focus> element, whose name property names the widget to receive the focus when the window is mapped. - An example of a UI definition fragment with accel groups: - <object class="GtkWindow"> <accel-groups> <group name="accelgroup1"/> </accel-groups> <initial-focus name="thunderclap"/> </object> ... <object class="GtkAccelGroup" id="accelgroup1"/>- The - Gtk.Windowimplementation of the- Gtk.Buildableinterface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.- CSS nodes
 - window.background ├── decoration ├── <titlebar child>.titlebar [.default-decoration] ╰── <child> - Gtk.Windowhas a main CSS node with name window and style class .background, and a subnode with name decoration.- 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). - Gtk.Windowalso represents window states with the following style classes on the main node: .tiled, .maximized, .fullscreen. Specialized types of window often add their own discriminating style classes, such as .popup or .tooltip.- Gtk.Windowadds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.- 
classmethod get_default_icon_list()[source]¶
- Returns: - copy of default icon list - Return type: - [ - GdkPixbuf.Pixbuf]- Gets the value set by - Gtk.Window.set_default_icon_list(). The list is a copy and should be freed with g_list_free(), but the pixbufs in the list have not had their reference count incremented.
 - 
classmethod get_default_icon_name()[source]¶
- Returns: - the fallback icon name for windows - Return type: - str- Returns the fallback icon name for windows that has been set with - Gtk.Window.set_default_icon_name(). The returned string is owned by GTK+ and should not be modified. It is only valid until the next call to- Gtk.Window.set_default_icon_name().- New in version 2.16. 
 - 
classmethod list_toplevels()[source]¶
- Returns: - list of toplevel widgets - Return type: - [ - 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.
 - 
classmethod new(type)[source]¶
- Parameters: - type ( - Gtk.WindowType) – type of window- Returns: - a new - Gtk.Window.- Return type: - Gtk.Widget- Creates a new - Gtk.Window, which is a toplevel window that can contain other widgets. Nearly always, the type of the window should be- Gtk.WindowType.TOPLEVEL. If you’re implementing something like a popup menu from scratch (which is a bad idea, just use- Gtk.Menu), you might use- Gtk.WindowType.POPUP.- Gtk.WindowType.POPUPis not for dialogs, though in some other toolkits dialogs are called “popups”. In GTK+,- Gtk.WindowType.POPUPmeans a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the window manager.- If you simply want an undecorated window (no window borders), use - Gtk.Window.set_decorated(), don’t use- Gtk.WindowType.POPUP.- All top-level windows created by - Gtk.Window.new() are stored in an internal top-level window list. This list can be obtained from- Gtk.Window.list_toplevels(). Due to Gtk+ keeping a reference to the window internally,- Gtk.Window.new() does not return a reference to the caller.- To delete a - Gtk.Window, call- Gtk.Widget.destroy().
 - 
classmethod set_auto_startup_notification(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto automatically do startup notification- By default, after showing the first - Gtk.Window, GTK+ calls- Gdk.notify_startup_complete(). 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. - New in version 2.2. 
 - 
classmethod set_default_icon(icon)[source]¶
- Parameters: - icon ( - GdkPixbuf.Pixbuf) – the icon- Sets an icon to be used as fallback for windows that haven’t had - Gtk.Window.set_icon() called on them from a pixbuf.- New in version 2.4. 
 - 
classmethod set_default_icon_from_file(filename)[source]¶
- Parameters: - filename ( - str) – location of icon file- Raises: - GLib.Error- Returns: - Trueif setting the icon succeeded.- Return type: - bool- Sets an icon to be used as fallback for windows that haven’t had - Gtk.Window.set_icon_list() called on them from a file on disk. Warns on failure if err is- None.- New in version 2.2. 
 - 
classmethod set_default_icon_list(list)[source]¶
- Parameters: - list ([ - GdkPixbuf.Pixbuf]) – a list of- GdkPixbuf.Pixbuf- Sets an icon list to be used as fallback for windows that haven’t had - Gtk.Window.set_icon_list() called on them to set up a window-specific icon list. This function allows you to set up the icon for all windows in your app at once.- See - Gtk.Window.set_icon_list() for more details.
 - 
classmethod set_default_icon_name(name)[source]¶
- Parameters: - name ( - str) – the name of the themed icon- Sets an icon to be used as fallback for windows that haven’t had - Gtk.Window.set_icon_list() called on them from a named themed icon, see- Gtk.Window.set_icon_name().- New in version 2.6. 
 - 
classmethod set_interactive_debugging(enable)[source]¶
- Parameters: - enable ( - bool) –- Trueto enable interactive debugging- Opens or closes the interactive debugger, which offers access to the widget hierarchy of the application and to useful debugging tools. - New in version 3.14. 
 - 
activate_default()[source]¶
- Returns: - Trueif a widget got activated.- Return type: - bool- Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see - Gtk.Widget.set_receives_default()), in which case the focused widget is activated.
 - 
activate_focus()[source]¶
- Returns: - Trueif a widget got activated.- Return type: - bool- Activates the current focused widget within the window. 
 - 
activate_key(event)[source]¶
- Parameters: - event ( - Gdk.EventKey) – a- Gdk.EventKey- Returns: - Trueif a mnemonic or accelerator was found and activated.- Return type: - bool- Activates mnemonics and accelerators for this - Gtk.Window. This is normally called by the default ::key_press_event handler for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.- New in version 2.4. 
 - 
add_accel_group(accel_group)[source]¶
- Parameters: - accel_group ( - Gtk.AccelGroup) – a- Gtk.AccelGroup- Associate accel_group with self, such that calling - Gtk.accel_groups_activate() on self will activate accelerators in accel_group.
 - 
add_mnemonic(keyval, target)[source]¶
- Parameters: - keyval (int) – the mnemonic
- target (Gtk.Widget) – the widget that gets activated by the mnemonic
 - Adds a mnemonic to this window. 
- keyval (
 - 
begin_move_drag(button, root_x, root_y, timestamp)[source]¶
- Parameters: - Starts moving a window. This function is used if an application has window movement grips. When GDK can support it, the window movement will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system. 
 - 
begin_resize_drag(edge, button, root_x, root_y, timestamp)[source]¶
- Parameters: - edge (Gdk.WindowEdge) – position of the resize control
- button (int) – mouse button that initiated the drag
- root_x (int) – X position where the user clicked to initiate the drag, in root window coordinates
- root_y (int) – Y position where the user clicked to initiate the drag
- timestamp (int) – timestamp from the click event that initiated the drag
 - Starts resizing a window. This function is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system. 
- edge (
 - 
close()[source]¶
- Requests that the window is closed, similar to what happens when a window manager close button is clicked. - This function can be used with close buttons in custom titlebars. - New in version 3.10. 
 - 
deiconify()[source]¶
- Asks to deiconify (i.e. unminimize) the specified self. Note that you shouldn’t assume the window is definitely deiconified afterward, because other entities (e.g. the user or window manager)) could iconify it again before your code which assumes deiconification gets to run. - You can track iconification via the “window-state-event” signal on - Gtk.Widget.
 - 
fullscreen()[source]¶
- Asks to place self in the fullscreen state. Note that you shouldn’t assume the window is definitely full screen afterward, because other entities (e.g. the user or window manager) could unfullscreen it again, and not all window managers honor requests to fullscreen windows. But normally the window will end up fullscreen. Just don’t write code that crashes if not. - You can track the fullscreen state via the “window-state-event” signal on - Gtk.Widget.- New in version 2.2. 
 - 
fullscreen_on_monitor(screen, monitor)[source]¶
- Parameters: - screen (Gdk.Screen) – aGdk.Screento draw to
- monitor (int) – which monitor to go fullscreen on
 - Asks to place self in the fullscreen state. Note that you shouldn’t assume the window is definitely full screen afterward. - You can track the fullscreen state via the “window-state-event” signal on - Gtk.Widget.- New in version 3.18. 
- screen (
 - 
get_accept_focus()[source]¶
- Returns: - Trueif window should receive the input focus- Return type: - bool- Gets the value set by - Gtk.Window.set_accept_focus().- New in version 2.4. 
 - 
get_application()[source]¶
- Returns: - a - Gtk.Application, or- None- Return type: - Gtk.Applicationor- None- Gets the - Gtk.Applicationassociated with the window (if any).- New in version 3.0. 
 - 
get_attached_to()[source]¶
- Returns: - the widget where the window is attached, or - Noneif the window is not attached to any widget.- Return type: - Gtk.Widgetor- None- Fetches the attach widget for this window. See - Gtk.Window.set_attached_to().- New in version 3.4. 
 - 
get_decorated()[source]¶
- Returns: - Trueif the window has been set to have decorations- Return type: - bool- Returns whether the window has been set to have decorations such as a title bar via - Gtk.Window.set_decorated().
 - 
get_default_size()[source]¶
- Returns: - width: - location to store the default width, or - None- height: - location to store the default height, or - None- Return type: - (width: - int, height:- int)- Gets the default size of the window. A value of -1 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. 
 - 
get_default_widget()[source]¶
- Returns: - the default widget, or - Noneif there is none.- Return type: - Gtk.Widgetor- None- Returns the default widget for self. See - Gtk.Window.set_default() for more details.- New in version 2.14. 
 - 
get_deletable()[source]¶
- Returns: - Trueif the window has been set to have a close button- Return type: - bool- Returns whether the window has been set to have a close button via - Gtk.Window.set_deletable().- New in version 2.10. 
 - 
get_destroy_with_parent()[source]¶
- Returns: - Trueif the window will be destroyed with its transient parent.- Return type: - bool- Returns whether the window will be destroyed with its transient parent. See - Gtk.Window.set_destroy_with_parent().
 - 
get_focus()[source]¶
- Returns: - the currently focused widget, or - Noneif there is none.- Return type: - Gtk.Widgetor- 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- Truefor the widget.
 - 
get_focus_on_map()[source]¶
- Returns: - Trueif window should receive the input focus when mapped.- Return type: - bool- Gets the value set by - Gtk.Window.set_focus_on_map().- New in version 2.6. 
 - 
get_focus_visible()[source]¶
- Returns: - Trueif “focus rectangles” are supposed to be visible in this window.- Return type: - bool- Gets the value of the - Gtk.Window- :focus-visibleproperty.- New in version 3.2. 
 - 
get_gravity()[source]¶
- Returns: - window gravity - Return type: - Gdk.Gravity- Gets the value set by - Gtk.Window.set_gravity().
 - 
get_group()[source]¶
- Returns: - the - Gtk.WindowGroupfor a window or the default group- Return type: - Gtk.WindowGroup- Returns the group for self or the default group, if self is - Noneor if self does not have an explicit window group.- New in version 2.10. 
 - 
get_has_resize_grip()[source]¶
- Returns: - Trueif the window has a resize grip- Return type: - bool- Determines whether the window may have a resize grip. - New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
 - 
get_hide_titlebar_when_maximized()[source]¶
- Returns: - Trueif the window has requested to have its titlebar hidden when maximized- Return type: - bool- Returns whether the window has requested to have its titlebar hidden when maximized. See - Gtk.Window.set_hide_titlebar_when_maximized().- New in version 3.4. 
 - 
get_icon()[source]¶
- Returns: - icon for window or - Noneif none- Return type: - GdkPixbuf.Pixbufor- None- Gets the value set by - Gtk.Window.set_icon() (or if you’ve called- Gtk.Window.set_icon_list(), gets the first icon in the icon list).
 - 
get_icon_list()[source]¶
- Returns: - copy of window’s icon list - Return type: - [ - GdkPixbuf.Pixbuf]- Retrieves the list of icons set by - Gtk.Window.set_icon_list(). The list is copied, but the reference count on each member won’t be incremented.
 - 
get_icon_name()[source]¶
- Returns: - the icon name or - Noneif the window has no themed icon- Return type: - stror- None- Returns the name of the themed icon for the window, see - Gtk.Window.set_icon_name().- New in version 2.6. 
 - 
get_mnemonic_modifier()[source]¶
- Returns: - the modifier mask used to activate mnemonics on this window. - Return type: - Gdk.ModifierType- Returns the mnemonic modifier for this window. See - Gtk.Window.set_mnemonic_modifier().
 - 
get_mnemonics_visible()[source]¶
- Returns: - Trueif mnemonics are supposed to be visible in this window.- Return type: - bool- Gets the value of the - Gtk.Window- :mnemonics-visibleproperty.- New in version 2.20. 
 - 
get_modal()[source]¶
- Returns: - Trueif the window is set to be modal and establishes a grab when shown- Return type: - bool- Returns whether the window is modal. See - Gtk.Window.set_modal().
 - 
get_opacity()[source]¶
- Returns: - the requested opacity for this window. - Return type: - float- Fetches the requested opacity for this window. See - Gtk.Window.set_opacity().- New in version 2.12. - Deprecated since version 3.8: Use - Gtk.Widget.get_opacityinstead.
 - 
get_position()[source]¶
- Returns: - root_x: - return location for X coordinate of gravity-determined reference point, or - None- root_y: - return location for Y coordinate of gravity-determined reference point, or - None- Return type: - (root_x: - int, root_y:- int)- This function returns the position you need to pass to - Gtk.Window.move() to keep self in its current position. This means that the meaning of the returned value varies with window gravity. See- Gtk.Window.move() for more details.- The reliability of this function depends on the windowing system currently in use. Some windowing systems, such as Wayland, do not support a global coordinate system, and thus the position of the window will always be (0, 0). Others, like X11, do not have a reliable way to obtain the geometry of the decorations of a window if they are provided by the window manager. Additionally, on X11, window manager have been known to mismanage window gravity, which result in windows moving even if you use the coordinates of the current position as returned by this function. - If you haven’t changed the window gravity, its gravity will be - Gdk.Gravity.NORTH_WEST. This means that- Gtk.Window.get_position() gets the position of the top-left corner of the window manager frame for the window.- Gtk.Window.move() sets the position of this same top-left corner.- If a window has gravity - Gdk.Gravity.STATICthe window manager frame is not relevant, and thus- Gtk.Window.get_position() will always produce accurate results. However you can’t use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations.- Ideally, this function should return appropriate values if the window has client side decorations, assuming that the windowing system supports global coordinates. - In practice, saving the window position should not be left to applications, as they lack enough knowledge of the windowing system and the window manager state to effectively do so. The appropriate way to implement saving the window position is to use a platform-specific protocol, wherever that is available. 
 - 
get_resizable()[source]¶
- Returns: - Trueif the user can resize the window- Return type: - bool- Gets the value set by - Gtk.Window.set_resizable().
 - 
get_resize_grip_area()[source]¶
- Returns: - Trueif the resize grip’s area was retrieved- rect: - a pointer to a - Gdk.Rectanglewhich we should store the resize grip area- Return type: - ( - bool, rect:- Gdk.Rectangle)- If a window has a resize grip, this will retrieve the grip position, width and height into the specified - Gdk.Rectangle.- New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
 - 
get_role()[source]¶
- Returns: - the role of the window if set, or - None. The returned is owned by the widget and must not be modified or freed.- Return type: - stror- None- Returns the role of the window. See - Gtk.Window.set_role() for further explanation.
 - 
get_screen()[source]¶
- Returns: - a - Gdk.Screen.- Return type: - Gdk.Screen- Returns the - Gdk.Screenassociated with self.- New in version 2.2. 
 - 
get_size()[source]¶
- Returns: - width: - return location for width, or - None- height: - return location for height, or - None- Return type: - (width: - int, height:- int)- Obtains the current size of self. - If self is not visible on screen, this function return the size GTK+ will suggest to the window manager for the initial window size (but this is not reliably the same as the size the window manager will actually select). See: - Gtk.Window.set_default_size().- Depending on the windowing system and the window manager constraints, the size returned by this function may not match the size set using - Gtk.Window.resize(); additionally, since- Gtk.Window.resize() may be implemented as an asynchronous operation, GTK+ cannot guarantee in any way that this code:- // width and height are set elsewhere gtk_window_resize (window, width, height); int new_width, new_height; gtk_window_get_size (window, &new_width, &new_height); - will result in - new_widthand- new_heightmatching- widthand- height, respectively.- This function will return the logical size of the - Gtk.Window, excluding the widgets used in client side decorations; there is, however, no guarantee that the result will be completely accurate because client side decoration may include widgets that depend on the user preferences and that may not be visibile at the time you call this function.- The dimensions returned by this function are suitable for being stored across sessions; use - Gtk.Window.set_default_size() to restore them when before showing the window.- To avoid potential race conditions, you should only call this function in response to a size change notification, for instance inside a handler for the - Gtk.Widget- ::size-allocatesignal, or inside a handler for the- Gtk.Widget- ::configure-eventsignal:- static void on_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { int new_width, new_height; gtk_window_get_size (GTK_WINDOW (widget), &new_width, &new_height); ... } - Note that, if you connect to the - Gtk.Widget- ::size-allocatesignal, you should not use the dimensions of the #GtkAllocation passed to the signal handler, as the allocation may contain client side decorations added by GTK+, depending on the windowing system in use.- If you are getting a window size in order to position the window on the screen, you should, instead, simply set the window’s semantic type with - Gtk.Window.set_type_hint(), which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with- Gtk.Window.set_transient_for() window managers will often center the dialog over its parent window. It’s much preferred to let the window manager handle these cases rather than doing it yourself, because all apps will behave consistently and according to user or system preferences, if the window manager handles it. Also, the window manager can take into account the size of the window decorations and border that it may add, and of which GTK+ has no knowledge. Additionally, positioning windows in global screen coordinates may not be allowed by the windowing system. For more information, see:- Gtk.Window.set_position().
 - 
get_skip_pager_hint()[source]¶
- Returns: - Trueif window shouldn’t be in pager- Return type: - bool- Gets the value set by - Gtk.Window.set_skip_pager_hint().- New in version 2.2. 
 - 
get_skip_taskbar_hint()[source]¶
- Returns: - Trueif window shouldn’t be in taskbar- Return type: - bool- Gets the value set by - Gtk.Window.set_skip_taskbar_hint()- New in version 2.2. 
 - 
get_title()[source]¶
- Returns: - the title of the window, or - Noneif none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.- Return type: - stror- None- Retrieves the title of the window. See - Gtk.Window.set_title().
 - 
get_titlebar()[source]¶
- Returns: - the custom titlebar, or - None- Return type: - Gtk.Widgetor- None- Returns the custom titlebar that has been set with - Gtk.Window.set_titlebar().- New in version 3.16. 
 - 
get_transient_for()[source]¶
- Returns: - the transient parent for this window, or - Noneif no transient parent has been set.- Return type: - Gtk.Windowor- None- Fetches the transient parent for this window. See - Gtk.Window.set_transient_for().
 - 
get_type_hint()[source]¶
- Returns: - the type hint for self. - Return type: - Gdk.WindowTypeHint- Gets the type hint for this window. See - Gtk.Window.set_type_hint().
 - 
get_urgency_hint()[source]¶
- Returns: - Trueif window is urgent- Return type: - bool- Gets the value set by - Gtk.Window.set_urgency_hint()- New in version 2.8. 
 - 
get_window_type()[source]¶
- Returns: - the type of the window - Return type: - Gtk.WindowType- Gets the type of the window. See - Gtk.WindowType.- New in version 2.20. 
 - 
has_group()[source]¶
- Returns: - Trueif self has an explicit window group.- Return type: - bool- Returns whether self has an explicit window group. 
 - 
has_toplevel_focus()[source]¶
- Returns: - Trueif the input focus is within this- Gtk.Window- Return type: - bool- Returns whether the input focus is within this - Gtk.Window. For real toplevel windows, this is identical to- Gtk.Window.is_active(), but for embedded windows, like- Gtk.Plug, the results will differ.- New in version 2.4. 
 - 
iconify()[source]¶
- Asks to iconify (i.e. minimize) the specified self. Note that you shouldn’t assume the window is definitely iconified afterward, because other entities (e.g. the user or window manager) could deiconify it again, or there may not be a window manager in which case iconification isn’t possible, etc. But normally the window will end up iconified. Just don’t write code that crashes if not. - It’s permitted to call this function before showing a window, in which case the window will be iconified before it ever appears onscreen. - You can track iconification via the “window-state-event” signal on - Gtk.Widget.
 - 
is_active()[source]¶
- Returns: - Trueif the window part of the current active window.- Return type: - bool- Returns whether the window is part of the current active toplevel. (That is, the toplevel window receiving keystrokes.) The return value is - Trueif the window is active toplevel itself, but also if it is, say, a- Gtk.Plugembedded in the active toplevel. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window. See- Gtk.Window.has_toplevel_focus()- New in version 2.4. 
 - 
is_maximized()[source]¶
- Returns: - whether the window has a maximized state. - Return type: - bool- Retrieves the current maximized state of self. - 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 - Gtk.Window.maximize() or- Gtk.Window.unmaximize().- New in version 3.12. 
 - 
maximize()[source]¶
- Asks to maximize self, so that it becomes full-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. But normally the window will end up maximized. Just don’t write code that crashes if not. - 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 maximization via the “window-state-event” signal on - Gtk.Widget, or by listening to notifications on the- Gtk.Window- :is-maximizedproperty.
 - 
mnemonic_activate(keyval, modifier)[source]¶
- Parameters: - keyval (int) – the mnemonic
- modifier (Gdk.ModifierType) – the modifiers
 - Returns: - Trueif the activation is done.- Return type: - Activates the targets associated with the mnemonic. 
- keyval (
 - 
move(x, y)[source]¶
- Parameters: - Asks the window manager to move self to the given position. Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown. - Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point. - By default the gravity is - Gdk.Gravity.NORTH_WEST, so the reference point is simply the x, y supplied to- Gtk.Window.move(). The top-left corner of the window decorations (aka window frame or border) will be placed at x, y. Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is- Gdk.Gravity.NORTH_WEST) and move the window to 0,0.- To position a window at the bottom right corner of the screen, you would set - Gdk.Gravity.SOUTH_EAST, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point. So, to place a window in the bottom right corner you would first set gravity to south east, then write:- gtk_window_move (window, gdk_screen_width () - window_width, gdk_screen_height () - window_height)(note that this example does not take multi-head scenarios into account).- The Extended Window Manager Hints Specification has a nice table of gravities in the “implementation notes” section. - The - Gtk.Window.get_position() documentation may also be relevant.
 - 
parse_geometry(geometry)[source]¶
- Parameters: - geometry ( - str) – geometry string- Returns: - Trueif string was parsed successfully- Return type: - bool- Parses a standard X Window System geometry string - see the manual page for X (type “man X”) for details on this. - Gtk.Window.parse_geometry() does work on all GTK+ ports including Win32 but is primarily intended for an X environment.- If either a size or a position can be extracted from the geometry string, - Gtk.Window.parse_geometry() returns- Trueand calls- Gtk.Window.set_default_size() and/or- Gtk.Window.move() to resize/move the window.- If - Gtk.Window.parse_geometry() returns- True, it will also set the- Gdk.WindowHints.USER_POSand/or- Gdk.WindowHints.USER_SIZEhints indicating to the window manager that the size/position of the window was user-specified. This causes most window managers to honor the geometry.- Note that for - Gtk.Window.parse_geometry() to work as expected, it has to be called when the window has its “final” size, i.e. after calling- Gtk.Widget.show_all() on the contents and- Gtk.Window.set_geometry_hints() on the window.- #include <gtk/gtk.h> static void fill_with_content (GtkWidget *vbox) { // fill with content... } int main (int argc, char *argv[]) { GtkWidget *window, *vbox; GdkGeometry size_hints = { 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST }; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); fill_with_content (vbox); gtk_widget_show_all (vbox); gtk_window_set_geometry_hints (GTK_WINDOW (window), NULL, &size_hints, GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC); if (argc > 1) { gboolean res; res = gtk_window_parse_geometry (GTK_WINDOW (window), argv[1]); if (! res) fprintf (stderr, "Failed to parse “%s”\n", argv[1]); } gtk_widget_show_all (window); gtk_main (); return 0; } - Deprecated since version 3.20: Geometry handling in GTK is deprecated. 
 - 
present()[source]¶
- Presents a window to the user. This function should not be used as when it is called, it is too late to gather a valid timestamp to allow focus stealing prevention to work correctly. 
 - 
present_with_time(timestamp)[source]¶
- Parameters: - timestamp ( - int) – the timestamp of the user interaction (typically a button or key press event) which triggered this call- Presents a window to the user. This may mean raising the window in the stacking order, deiconifying 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 self is hidden, this function calls - Gtk.Widget.show() as well.- This function should be used when the user tries to open a window that’s already open. Say for example the preferences dialog is currently open, and the user chooses Preferences from the menu a second time; use - Gtk.Window.present() to move the already-open dialog where the user can see it.- Presents a window to the user in response to a user interaction. 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. - New in version 2.8. 
 - 
propagate_key_event(event)[source]¶
- Parameters: - event ( - Gdk.EventKey) – a- Gdk.EventKey- Returns: - Trueif a widget in the focus chain handled the event.- Return type: - bool- Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event. This is normally called by the default ::key_press_event and ::key_release_event handlers for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window. - New in version 2.4. 
 - 
remove_accel_group(accel_group)[source]¶
- Parameters: - accel_group ( - Gtk.AccelGroup) – a- Gtk.AccelGroup- Reverses the effects of - Gtk.Window.add_accel_group().
 - 
remove_mnemonic(keyval, target)[source]¶
- Parameters: - keyval (int) – the mnemonic
- target (Gtk.Widget) – the widget that gets activated by the mnemonic
 - Removes a mnemonic from this window. 
- keyval (
 - 
reshow_with_initial_size()[source]¶
- Hides self, then reshows it, resetting the default size and position of the window. Used by GUI builders only. - Deprecated since version 3.10: GUI builders can call - Gtk.Widget.hide(),- Gtk.Widget.unrealize() and then- Gtk.Widget.show() on window themselves, if they still need this functionality.
 - 
resize(width, height)[source]¶
- Parameters: - Resizes the window as if the user had done so, obeying geometry constraints. The default geometry constraint is that windows may not be smaller than their size request; to override this constraint, call - Gtk.Widget.set_size_request() to set the window’s request to a smaller value.- If - Gtk.Window.resize() is called before showing a window for the first time, it overrides any default size set with- Gtk.Window.set_default_size().- Windows may not be resized smaller than 1 by 1 pixels. - When using client side decorations, GTK+ will do its best to adjust the given size so that the resulting window size matches the requested size without the title bar, borders and shadows added for the client side decorations, but there is no guarantee that the result will be totally accurate because these widgets added for client side decorations depend on the theme and may not be realized or visible at the time - Gtk.Window.resize() is issued.- If the - Gtk.Windowhas a titlebar widget (see- Gtk.Window.set_titlebar()), then typically,- Gtk.Window.resize() will compensate for the height of the titlebar widget only if the height is known when the resulting- Gtk.Windowconfiguration is issued. For example, if new widgets are added after the- Gtk.Windowconfiguration and cause the titlebar widget to grow in height, this will result in a window content smaller that specified by- Gtk.Window.resize() and not a larger window.
 - 
resize_grip_is_visible()[source]¶
- Returns: - Trueif a resize grip exists and is visible- Return type: - bool- Determines whether a resize grip is visible for the specified window. - New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
 - 
resize_to_geometry(width, height)[source]¶
- Parameters: - Like - Gtk.Window.resize(), but width and height are interpreted in terms of the base size and increment set with- Gtk.Window.set_geometry_hints.- New in version 3.0. - Deprecated since version 3.20: This function does nothing. Use - Gtk.Window.resize() and compute the geometry yourself.
 - 
set_accept_focus(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto let this window receive input focus- Windows may set a hint asking the desktop environment not to receive the input focus. This function sets this hint. - New in version 2.4. 
 - 
set_application(application)[source]¶
- Parameters: - application ( - Gtk.Applicationor- None) – a- Gtk.Application, or- Noneto unset- Sets or unsets the - Gtk.Applicationassociated with the window.- The application will be kept alive for at least as long as it has any windows associated with it (see - 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 - None.- This is equivalent to calling - Gtk.Application.remove_window() and/or- Gtk.Application.add_window() on the old/new applications as relevant.- New in version 3.0. 
 - 
set_attached_to(attach_widget)[source]¶
- Parameters: - attach_widget ( - Gtk.Widgetor- None) – a- Gtk.Widget, or- None- Marks self as attached to attach_widget. This creates a logical binding between the window and the widget it belongs to, which is used by GTK+ to propagate information such as styling or accessibility to self as if it was a children of attach_widget. - Examples of places where specifying this relation is useful are for instance a - Gtk.Menucreated by a- Gtk.ComboBox, a completion popup window created by- Gtk.Entryor a typeahead search entry created by- Gtk.TreeView.- Note that this function should not be confused with - Gtk.Window.set_transient_for(), which specifies a window manager relation between two toplevels instead.- Passing - Nonefor attach_widget detaches the window.- New in version 3.4. 
 - 
set_decorated(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto decorate the window- 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 - Falseusing 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- Gtk.Widget.show().- On Windows, this function always works, since there’s no window manager policy involved. 
 - 
set_default(default_widget)[source]¶
- Parameters: - default_widget ( - Gtk.Widgetor- None) – widget to be the default, or- Noneto unset the default widget for the toplevel- The default widget is the widget that’s activated when the user presses Enter in a dialog (for example). This function sets or unsets the default widget for a - Gtk.Window. When setting (rather than unsetting) the default widget it’s generally easier to call- Gtk.Widget.grab_default() on the widget. Before making a widget the default widget, you must call- Gtk.Widget.set_can_default() on the widget you’d like to make the default.
 - 
set_default_geometry(width, height)[source]¶
- Parameters: - Like - Gtk.Window.set_default_size(), but width and height are interpreted in terms of the base size and increment set with- Gtk.Window.set_geometry_hints.- New in version 3.0. - Deprecated since version 3.20: This function does nothing. If you want to set a default size, use - Gtk.Window.set_default_size() instead.
 - 
set_default_size(width, height)[source]¶
- Parameters: - Sets the default size of a window. If the window’s “natural” size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the window ( - Gtk.Window.set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.- Unlike - 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).- For more control over a window’s initial size and how resizing works, investigate - Gtk.Window.set_geometry_hints().- For some uses, - Gtk.Window.resize() is a more appropriate function.- Gtk.Window.resize() changes the current size of the window, rather than the size to be used on initial display.- Gtk.Window.resize() always affects the window itself, not the geometry widget.- The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size. - Windows can’t actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size. - If you use this function to reestablish a previously saved window size, note that the appropriate size to save is the one returned by - Gtk.Window.get_size(). Using the window allocation directly will not work in all circumstances and can lead to growing or shrinking windows.
 - 
set_deletable(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto decorate the window as 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 - Falseusing 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- Gtk.Widget.show().- On Windows, this function always works, since there’s no window manager policy involved. - New in version 2.10. 
 - 
set_destroy_with_parent(setting)[source]¶
- Parameters: - setting ( - bool) – whether to destroy self with its transient parent- If setting is - True, then destroying the transient parent of self will also destroy self itself. This is useful for dialogs that shouldn’t persist beyond the lifetime of the main window they’re associated with, for example.
 - 
set_focus(focus)[source]¶
- Parameters: - focus ( - Gtk.Widgetor- None) – widget to be the new focus widget, or- Noneto unset any focus widget for the toplevel window.- If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. If focus is - 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- Gtk.Widget.grab_focus() instead of this function.
 - 
set_focus_on_map(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto let this window receive input focus on map- Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped. This function sets this hint. - New in version 2.6. 
 - 
set_focus_visible(setting)[source]¶
- Parameters: - setting ( - bool) – the new value- Sets the - Gtk.Window- :focus-visibleproperty.- New in version 3.2. 
 - 
set_geometry_hints(geometry_widget, geometry, geom_mask)[source]¶
- Parameters: - geometry_widget (Gtk.WidgetorNone) – widget the geometry hints used to be applied to orNone. Since 3.20 this argument is ignored and GTK behaves as ifNonewas set.
- geometry (Gdk.GeometryorNone) – struct containing geometry information orNone
- geom_mask (Gdk.WindowHints) – mask indicating which struct fields should be paid attention to
 - This function sets up hints about how a window can be resized by the user. You can set a minimum and maximum size; allowed resize increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. See the - Gdk.Geometrystruct.
- geometry_widget (
 - 
set_gravity(gravity)[source]¶
- Parameters: - gravity ( - Gdk.Gravity) – window gravity- Window gravity defines the meaning of coordinates passed to - Gtk.Window.move(). See- Gtk.Window.move() and- Gdk.Gravityfor more details.- The default window gravity is - Gdk.Gravity.NORTH_WESTwhich will typically “do what you mean.”
 - 
set_has_resize_grip(value)[source]¶
- Parameters: - value ( - bool) –- Trueto allow a resize grip- Sets whether self has a corner resize grip. - Note that the resize grip is only shown if the window is actually resizable and not maximized. Use - Gtk.Window.resize_grip_is_visible() to find out if the resize grip is currently shown.- New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
 - 
set_has_user_ref_count(setting)[source]¶
- Parameters: - setting ( - bool) – the new value- Tells GTK+ whether to drop its extra reference to the window when - Gtk.Widget.destroy() is called.- This function is only exported for the benefit of language bindings which may need to keep the window alive until their wrapper object is garbage collected. There is no justification for ever calling this function in an application. - New in version 3.0. 
 - 
set_hide_titlebar_when_maximized(setting)[source]¶
- Parameters: - setting ( - bool) – whether to hide the titlebar when self is maximized- If setting is - True, then self will request that it’s titlebar should be hidden when maximized. This is useful for windows that don’t convey any information other than the application name in the titlebar, to put the available screen space to better use. If the underlying window system does not support the request, the setting will not have any effect.- Note that custom titlebars set with - Gtk.Window.set_titlebar() are not affected by this. The application is in full control of their content and visibility anyway.- New in version 3.4. 
 - 
set_icon(icon)[source]¶
- Parameters: - icon ( - GdkPixbuf.Pixbufor- None) – icon image, or- None- Sets up the icon representing a - Gtk.Window. This icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. On others, the icon is not used at all, so your mileage may vary.- The icon should be provided in whatever size it was naturally drawn; that is, don’t scale the image before passing it to GTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. - If you have your icon hand-drawn in multiple sizes, use - Gtk.Window.set_icon_list(). Then the best size will be used.- This function is equivalent to calling - Gtk.Window.set_icon_list() with a 1-element list.- See also - Gtk.Window.set_default_icon_list() to set the icon for all windows in your application in one go.
 - 
set_icon_from_file(filename)[source]¶
- Parameters: - filename ( - str) – location of icon file- Raises: - GLib.Error- Returns: - Trueif setting the icon succeeded.- Return type: - bool- Sets the icon for self. Warns on failure if err is - None.- This function is equivalent to calling - Gtk.Window.set_icon() with a pixbuf created by loading the image from filename.- New in version 2.2. 
 - 
set_icon_list(list)[source]¶
- Parameters: - list ([ - GdkPixbuf.Pixbuf]) – list of- GdkPixbuf.Pixbuf- Sets up the icon representing a - Gtk.Window. The icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. On others, the icon is not used at all, so your mileage may vary.- Gtk.Window.set_icon_list() allows you to pass in the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is available in; that is, don’t scale the image before passing it to GTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.- By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling. - Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them. - See also - Gtk.Window.set_default_icon_list() to set the icon for all windows in your application in one go.- Note that transient windows (those who have been set transient for another window using - Gtk.Window.set_transient_for()) will inherit their icon from their transient parent. So there’s no need to explicitly set the icon on transient windows.
 - 
set_icon_name(name)[source]¶
- Parameters: - name ( - stror- None) – the name of the themed icon- Sets the icon for the window from a named themed icon. See the docs for - Gtk.IconThemefor 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. - New in version 2.6. 
 - 
set_keep_above(setting)[source]¶
- Parameters: - setting ( - bool) – whether to keep self above other windows- Asks to keep self above, so that it stays on top. Note that you shouldn’t assume the window is definitely above afterward, because other entities (e.g. the user or window manager) could not keep it above, and not all window managers support keeping windows above. But normally the window will end kept above. Just don’t write code that crashes if not. - It’s permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially. - You can track the above state via the “window-state-event” signal on - Gtk.Widget.- Note that, according to the Extended Window Manager Hints Specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs. - New in version 2.4. 
 - 
set_keep_below(setting)[source]¶
- Parameters: - setting ( - bool) – whether to keep self below other windows- Asks to keep self below, so that it stays in bottom. Note that you shouldn’t assume the window is definitely below afterward, because other entities (e.g. the user or window manager) could not keep it below, and not all window managers support putting windows below. But normally the window will be kept below. Just don’t write code that crashes if not. - It’s permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially. - You can track the below state via the “window-state-event” signal on - Gtk.Widget.- Note that, according to the Extended Window Manager Hints Specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs. - New in version 2.4. 
 - 
set_mnemonic_modifier(modifier)[source]¶
- Parameters: - modifier ( - Gdk.ModifierType) – the modifier mask used to activate mnemonics on this window.- Sets the mnemonic modifier for this window. 
 - 
set_mnemonics_visible(setting)[source]¶
- Parameters: - setting ( - bool) – the new value- Sets the - Gtk.Window- :mnemonics-visibleproperty.- New in version 2.20. 
 - 
set_modal(modal)[source]¶
- Parameters: - modal ( - bool) – whether the window is modal- 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 - 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.
 - 
set_opacity(opacity)[source]¶
- Parameters: - opacity ( - float) – desired opacity, between 0 and 1- Request the windowing system to make self partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) On X11 this has any effect only on X screens with a compositing manager running. See - Gtk.Widget.is_composited(). On Windows it should work always.- Note that setting a window’s opacity after the window has been shown causes it to flicker once on Windows. - New in version 2.12. - Deprecated since version 3.8: Use - Gtk.Widget.set_opacityinstead.
 - 
set_position(position)[source]¶
- Parameters: - position ( - Gtk.WindowPosition) – a position constraint.- Sets a position constraint for this window. If the old or new constraint is - Gtk.WindowPosition.CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.
 - 
set_resizable(resizable)[source]¶
- Parameters: - resizable ( - bool) –- Trueif the user can resize this window- Sets whether the user can resize a window. Windows are user resizable by default. 
 - 
set_role(role)[source]¶
- Parameters: - role ( - str) – unique identifier for the window to be used when restoring a session- This function is only useful on X11, not with other GTK+ targets. - In combination with the window title, the window role allows a window manager to identify “the same” window when an application is restarted. So for example you might set the “toolbox” role on your app’s toolbox window, so that when the user restarts their session, the window manager can put the toolbox back in the same place. - If a window already has a unique title, you don’t need to set the role, since the WM can use the title to identify the window when restoring the session. 
 - 
set_screen(screen)[source]¶
- Parameters: - screen ( - Gdk.Screen) – a- Gdk.Screen.- Sets the - Gdk.Screenwhere the self is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.- New in version 2.2. 
 - 
set_skip_pager_hint(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto keep this window from appearing in the pager- Windows may set a hint asking the desktop environment not to display the window in the pager. This function sets this hint. (A “pager” is any desktop navigation tool such as a workspace switcher that displays a thumbnail representation of the windows on the screen.) - New in version 2.2. 
 - 
set_skip_taskbar_hint(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto keep this window from appearing in the task bar- Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint. - New in version 2.2. 
 - 
set_startup_id(startup_id)[source]¶
- Parameters: - startup_id ( - str) – a string with startup-notification identifier- 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 - Gdk.Window. 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- Gtk.Window.present() or any equivalent function generating a window map event.- This function is only useful on X11, not with other GTK+ targets. - New in version 2.12. 
 - 
set_title(title)[source]¶
- Parameters: - title ( - str) – title of the window- Sets the title of the - Gtk.Window. 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.
 - 
set_titlebar(titlebar)[source]¶
- Parameters: - titlebar ( - Gtk.Widgetor- None) – the widget to use as titlebar- Sets a custom titlebar for self. - A typical widget used here is - 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 - Gtk.Widget.show().- New in version 3.10. 
 - 
set_transient_for(parent)[source]¶
- Parameters: - parent ( - Gtk.Windowor- None) – parent window, or- 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. gtk_dialog_new_with_buttons() and other convenience functions in GTK+ will sometimes call - Gtk.Window.set_transient_for() on your behalf.- Passing - Nonefor parent unsets the current transient window.- On Wayland, this function can also be used to attach a new - Gtk.WindowType.POPUPto a- Gtk.WindowType.TOPLEVELparent already mapped on screen so that the- Gtk.WindowType.POPUPwill be created as a subsurface-based window- Gdk.WindowType.SUBSURFACEwhich can be positioned at will relatively to the- Gtk.WindowType.TOPLEVELsurface.- On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X. 
 - 
set_type_hint(hint)[source]¶
- Parameters: - hint ( - Gdk.WindowTypeHint) – the window type- By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application. - This function should be called before the window becomes visible. - gtk_dialog_new_with_buttons() and other convenience functions in GTK+ will sometimes call - Gtk.Window.set_type_hint() on your behalf.
 - 
set_urgency_hint(setting)[source]¶
- Parameters: - setting ( - bool) –- Trueto mark this window as urgent- Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint. - New in version 2.8. 
 - 
set_wmclass(wmclass_name, wmclass_class)[source]¶
- Parameters: - Don’t use this function. It sets the X Window System “class” and “name” hints for a window. According to the ICCCM, you should always set these to the same value for all windows in an application, and GTK+ sets them to that value by default, so calling this function is sort of pointless. However, you may want to call - Gtk.Window.set_role() on each window in your application, for the benefit of the session manager. Setting the role allows the window manager to restore window positions when loading a saved session.- Deprecated since version 3.22. 
 - 
stick()[source]¶
- Asks to stick self, which means that it will appear on all user desktops. Note that you shouldn’t assume the window is definitely stuck afterward, because other entities (e.g. the user or window manager could unstick it again, and some window managers do not support sticking windows. But normally the window will end up stuck. Just don’t write code that crashes if not. - It’s permitted to call this function before showing a window. - You can track stickiness via the “window-state-event” signal on - Gtk.Widget.
 - 
unfullscreen()[source]¶
- Asks to toggle off the fullscreen state for self. Note that you shouldn’t assume the window is definitely not full screen 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. But normally the window will end up restored to its normal state. Just don’t write code that crashes if not. - You can track the fullscreen state via the “window-state-event” signal on - Gtk.Widget.- New in version 2.2. 
 - 
unmaximize()[source]¶
- Asks to unmaximize self. Note that you shouldn’t assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) could maximize it again, and not all window managers honor requests to unmaximize. But normally the window will end up unmaximized. Just don’t write code that crashes if not. - You can track maximization via the “window-state-event” signal on - Gtk.Widget.
 - 
unstick()[source]¶
- Asks to unstick self, which means that it will appear on only one of the user’s desktops. Note that you shouldn’t assume the window is definitely unstuck afterward, because other entities (e.g. the user or window manager) could stick it again. But normally the window will end up stuck. Just don’t write code that crashes if not. - You can track stickiness via the “window-state-event” signal on - Gtk.Widget.
 - 
do_activate_default() virtual¶
 - 
do_activate_focus() virtual¶
 - 
do_keys_changed() virtual¶
 - 
do_set_focus(focus) virtual¶
- Parameters: - focus ( - Gtk.Widgetor- None) – widget to be the new focus widget, or- Noneto unset any focus widget for the toplevel window.- If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. If focus is - 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- Gtk.Widget.grab_focus() instead of this function.
 
Signal Details¶
- 
Gtk.Window.signals.activate_default(window)¶
- Signal Name: - activate-default- Flags: - RUN_LAST,- ACTION- Parameters: - window ( - Gtk.Window) – The object which received the signal- The - ::activate-defaultsignal is a- keybinding signalwhich gets emitted when the user activates the default widget of window.
- 
Gtk.Window.signals.activate_focus(window)¶
- Signal Name: - activate-focus- Flags: - RUN_LAST,- ACTION- Parameters: - window ( - Gtk.Window) – The object which received the signal- The - ::activate-focussignal is a- keybinding signalwhich gets emitted when the user activates the currently focused widget of window.
- 
Gtk.Window.signals.enable_debugging(window, toggle)¶
- Signal Name: - enable-debugging- Flags: - Parameters: - window (Gtk.Window) – The object which received the signal
- toggle (bool) – toggle the debugger
 - Returns: - Trueif the key binding was handled- Return type: - The - ::enable-debuggingsignal is a- keybinding signalwhich gets emitted when the user enables or disables interactive debugging. When toggle is- True, interactive debugging is toggled on or off, when it is- False, the debugger will be pointed at the widget under the pointer.- The default bindings for this signal are Ctrl-Shift-I and Ctrl-Shift-D. 
- window (
- 
Gtk.Window.signals.keys_changed(window)¶
- Signal Name: - keys-changed- Flags: - RUN_FIRST- Parameters: - window ( - Gtk.Window) – The object which received the signal- The - ::keys-changedsignal gets emitted when the set of accelerators or mnemonics that are associated with window changes.
- 
Gtk.Window.signals.set_focus(window, widget)¶
- Signal Name: - set-focus- Flags: - Parameters: - window (Gtk.Window) – The object which received the signal
- widget (Gtk.WidgetorNone) – the newly focused widget (orNonefor no focus)
 - This signal is emitted whenever the currently focused widget in this window changes. - New in version 2.24. 
- window (
Property Details¶
- 
Gtk.Window.props.accept_focus¶
- Name: - accept-focus- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the window should receive the input focus. - New in version 2.4. 
- 
Gtk.Window.props.application¶
- Name: - application- Type: - Gtk.Application- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The - Gtk.Applicationassociated with the window.- The application will be kept alive for at least as long as it has any windows associated with it (see - 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 - :applicationproperty to- None.- New in version 3.0. 
- 
Gtk.Window.props.attached_to¶
- Name: - attached-to- Type: - Gtk.Widget- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT,- EXPLICIT_NOTIFY- The widget to which this window is attached. See - Gtk.Window.set_attached_to().- Examples of places where specifying this relation is useful are for instance a - Gtk.Menucreated by a- Gtk.ComboBox, a completion popup window created by- Gtk.Entryor a typeahead search entry created by- Gtk.TreeView.- New in version 3.4. 
- 
Gtk.Window.props.decorated¶
- Name: - decorated- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the window should be decorated by the window manager. - New in version 2.4. 
- 
Gtk.Window.props.default_height¶
- Name: - default-height- Type: - int- Default Value: - -1- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The default height of the window, used when initially showing the window 
- 
Gtk.Window.props.default_width¶
- Name: - default-width- Type: - int- Default Value: - -1- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The default width of the window, used when initially showing the window 
- 
Gtk.Window.props.deletable¶
- Name: - deletable- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the window frame should have a close button. - New in version 2.10. 
- 
Gtk.Window.props.destroy_with_parent¶
- Name: - destroy-with-parent- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- If this window should be destroyed when the parent is destroyed 
- 
Gtk.Window.props.focus_on_map¶
- Name: - focus-on-map- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the window should receive the input focus when mapped. - New in version 2.6. 
- 
Gtk.Window.props.focus_visible¶
- Name: - focus-visible- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- 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. - New in version 2.20. 
- 
Gtk.Window.props.gravity¶
- Name: - gravity- Type: - Gdk.Gravity- Default Value: - Gdk.Gravity.NORTH_WEST- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The window gravity of the window. See - Gtk.Window.move() and- Gdk.Gravityfor more details about window gravity.- New in version 2.4. 
- 
Gtk.Window.props.has_resize_grip¶
- Name: - has-resize-grip- Type: - bool- Default Value: - False- Flags: - DEPRECATED,- READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the window has a corner resize grip. - Note that the resize grip is only shown if the window is actually resizable and not maximized. Use - Gtk.Window- :resize-grip-visibleto find out if the resize grip is currently shown.- New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
- 
Gtk.Window.props.has_toplevel_focus¶
- Name: - has-toplevel-focus- Type: - bool- Default Value: - False- Flags: - READABLE- Whether the input focus is within this - Gtk.Window
- 
Gtk.Window.props.hide_titlebar_when_maximized¶
- Name: - hide-titlebar-when-maximized- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the titlebar should be hidden during maximization. - New in version 3.4. 
- 
Gtk.Window.props.icon¶
- Name: - icon- Type: - GdkPixbuf.Pixbuf- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Icon for this window 
- 
Gtk.Window.props.icon_name¶
- Name: - icon-name- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The - :icon-nameproperty specifies the name of the themed icon to use as the window icon. See- Gtk.IconThemefor more details.- New in version 2.6. 
- 
Gtk.Window.props.is_active¶
- Name: - is-active- Type: - bool- Default Value: - False- Flags: - READABLE- Whether the toplevel is the current active window 
- 
Gtk.Window.props.is_maximized¶
- Name: - is-maximized- Type: - bool- Default Value: - False- Flags: - READABLE- Whether the window is maximized 
- 
Gtk.Window.props.mnemonics_visible¶
- Name: - mnemonics-visible- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- 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. - New in version 2.20. 
- 
Gtk.Window.props.modal¶
- Name: - modal- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- If - True, the window is modal (other windows are not usable while this one is up)
- 
Gtk.Window.props.resizable¶
- Name: - resizable- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- If - True, users can resize the window
- 
Gtk.Window.props.resize_grip_visible¶
- Name: - resize-grip-visible- Type: - bool- Default Value: - False- Flags: - DEPRECATED,- READABLE- Whether a corner resize grip is currently shown. - New in version 3.0. - Deprecated since version 3.14: Resize grips have been removed. 
- 
Gtk.Window.props.role¶
- Name: - role- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- Unique identifier for the window to be used when restoring a session 
- 
Gtk.Window.props.screen¶
- Name: - screen- Type: - Gdk.Screen- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The screen where this window will be displayed 
- 
Gtk.Window.props.skip_pager_hint¶
- Name: - skip-pager-hint- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Trueif the window should not be in the pager.
- 
Gtk.Window.props.skip_taskbar_hint¶
- Name: - skip-taskbar-hint- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Trueif the window should not be in the task bar.
- 
Gtk.Window.props.startup_id¶
- Name: - startup-id- Type: - str- Default Value: - None- Flags: - WRITABLE- The - :startup-idis a write-only property for setting window’s startup notification identifier. See- Gtk.Window.set_startup_id() for more details.- New in version 2.12. 
- 
Gtk.Window.props.title¶
- Name: - title- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- The title of the window 
- 
Gtk.Window.props.transient_for¶
- Name: - transient-for- Type: - Gtk.Window- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT,- EXPLICIT_NOTIFY- The transient parent of the window. See - Gtk.Window.set_transient_for() for more details about transient windows.- New in version 2.10. 
- 
Gtk.Window.props.type¶
- Name: - type- Type: - Gtk.WindowType- Default Value: - Gtk.WindowType.TOPLEVEL- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The type of the window 
- 
Gtk.Window.props.type_hint¶
- Name: - type-hint- Type: - Gdk.WindowTypeHint- Default Value: - Gdk.WindowTypeHint.NORMAL- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Hint to help the desktop environment understand what kind of window this is and how to treat it. 
- 
Gtk.Window.props.urgency_hint¶
- Name: - urgency-hint- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Trueif the window should be brought to the user’s attention.
- 
Gtk.Window.props.window_position¶
- Name: - window-position- Type: - Gtk.WindowPosition- Default Value: - Gtk.WindowPosition.NONE- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The initial position of the window