gtk.Window

gtk.Window — a top-level window that holds one child widget.

Synopsis

class gtk.Window(gtk.Bin):
    gtk.Window(type=gtk.WINDOW_TOPLEVEL)
def set_title(title)
def get_title()
def set_wmclass(wmclass_name, wmclass_class)
def set_role(role)
def get_role()
def add_accel_group(accel_group)
def remove_accel_group(accel_group)
def set_position(position)
def activate_focus()
def set_focus(focus)
def get_focus()
def set_default(default_widget)
def activate_default()
def set_transient_for(parent)
def get_transient_for()
def set_type_hint(hint)
def get_type_hint()
def set_destroy_with_parent(setting)
def get_destroy_with_parent()
def set_resizable(resizable)
def get_resizable()
def set_gravity(gravity)
def get_gravity()
def set_geometry_hints(geometry_widget, min_width=-1, min_height=-1, max_width=-1, max_height=-1, base_width=-1, base_height=-1, width_inc=-1, height_inc=-1, min_aspect=-1.0, max_aspect=-1.0)
def set_screen(screen)
def get_screen()
def is_active()
def has_toplevel_focus()
def set_has_frame(setting)
def get_has_frame()
def set_frame_dimensions(left, top, right, bottom)
def get_frame_dimensions()
def set_decorated(setting)
def get_decorated()
def set_icon_list(...)
def get_icon_list()
def set_icon(icon)
def set_icon_from_file(filename)
def get_icon()
def set_modal(modal)
def get_modal()
def add_mnemonic(keyval, target)
def remove_mnemonic(keyval, target)
def mnemonic_activate(keyval, modifier)
def set_mnemonic_modifier(modifier)
def get_mnemonic_modifier()
def activate_key(event)
def propagate_key_event(event)
def present()
def iconify()
def deiconify()
def stick()
def unstick()
def maximize()
def unmaximize()
def fullscreen()
def unfullscreen()
def set_keep_above(setting)
def set_keep_below(setting)
def begin_resize_drag(edge, button, root_x, root_y, timestamp)
def begin_move_drag(button, root_x, root_y, timestamp)
def set_default_size(width, height)
def get_default_size()
def resize(width, height)
def get_size()
def move(x, y)
def get_position()
def parse_geometry(geometry)
def reshow_with_initial_size()
def tooltips_get_info_from_tip_window()
def set_focus_on_map(setting)
def get_focus_on_map()
def set_icon_name(name)
def get_icon_name()
def set_urgency_hint(urgency_hint)
def get_urgency_hint()
def present_with_time(timestamp)
def set_deletable(setting)
def get_deletable()
def get_group()
def set_opacity(opacity)
def get_opacity()
def set_startup_id(startup_id)
Functions

    def gtk.window_set_default_icon(icon)
def gtk.window_set_default_icon_from_file(filename)
def gtk.window_set_default_icon_list(...)
def gtk.window_get_default_icon_list()
def gtk.window_set_auto_startup_notification(setting)
def gtk.window_list_toplevels()
def gtk.window_set_default_icon_name(name)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Bin
          +-- gtk.Window

Implemented Interfaces

gtk.Window implements gtk.Buildable

gtk.Window Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"accept-focus"Read-WriteIf True, the window should receive the input focus. Default value: True. Available in GTK+ 2.4 and above.
"allow-grow"Read-WriteIf True, the user can expand the window beyond its minimum size. Default value: True.
"allow-shrink"Read-WriteIf True, the window has no minimum size. Setting this to True is a bad idea 99% of the time. Default value: False.
"decorated"Read-WriteIf True, the window should be decorated by the window manager. Default value: True. Available in GTK+ 2.4 and above.
"default-height"Read-WriteThe default height of the window, used when initially showing the window. Allowed values: >= -1. Default value: -1
"default-width"Read-WriteThe default width of the window, used when initially showing the window. Allowed values: >= -1. Default value: -1
"deletable"Read-WriteIf True the window frame should have a close button. This property is available in GTK+ 2.10 and above.
"destroy-with-parent"Read-WriteIf True, the window should be destroyed when its parent is destroyed. Default value: False.
"focus-on-map"Read-WriteIf True, the window should receive the input focus when mapped. Default value: True. Available in GTK+ 2.6 and above.
"gravity"Read-WriteThe window gravity of the window. See the move() method and the GDK Gravity Constants for more details about window gravity. Default value: gtk.gdk.GRAVITY_NORTH_WEST. Available in GTK+ 2.4 and above.
"has-toplevel-focus"ReadIf True, the input focus is within the window. Default value: False. Available in GTK+ 2.2 and above.
"icon"Read-WriteThe icon for this window
"icon-name"Read-WriteThe name of the themed icon to use as the window icon. See gtk.IconTheme for more details. Default value: None. Available in GTK+ 2.6 and above.
"is-active"ReadIf True, the toplevel is the current active window. Default value: False. Available in GTK+ 2.2 and above.
"modal"Read-WriteIf True, the window is modal (other windows are not usable while this one is up). Default value: False.
"opacity"Read-WriteThe requested opacity of the window. See gtk.Window.set_opacity() for more details about window opacity. Allowed values: [0,1] Default value: 1. Available in GTK+ 2.12.
"resizable"Read-WriteIf True, the user can resize the window. Default value: True.
"role"Read-WriteUnique identifier for the window to be used when restoring a session. Default value: None. Available in GTK+ 2.4
"screen"Read-WriteThe screen where this window will be displayed. Available in GTK+ 2.2
"skip-pager-hint"Read-WriteIf True, the window should not be in the pager. Default value: False. Available in GTK+ 2.2 and above.
"skip-taskbar-hint"Read-WriteIf True, the window should not be in the task bar. Default value: False. Available in GTK+ 2.2 and above.
"startup-id"WriteThe :startup-id is a write-only property for setting window's startup notification identifier. See gtk.Window.set_startup_id() for more details. Default value: NULL. Available in GTK+ 2.12 and above.
"title"Read-WriteThe title of the window. Default value: None.
"transient-for"Read-Write-ConstructThe transient parent of the window. See gtk.Window.set_transient_for() for more details about transient windows. This property is available in GTK+ 2.10 and above.
"type"Read-WriteThe type of the window. Default value: gtk.WINDOW_TOPLEVEL
"type-hint"Read-WriteHint to help the desktop environment understand what kind of window this is and how to treat it. Default value: gtk.gdk.WINDOW_TYPE_HINT_NORMAL. Available in GTK+ 2.2 and above.
"urgency-hint"Read-WriteIf True the window should be brought to the users attention. Default value: False. Available in GTK+ 2.8 and above.
"window-position"Read-WriteThe initial position of the window. Default value: gtk.WIN_POS_NONE

gtk.Window Style Properties

gtk.Widget Style Properties

Attributes

"allow_grow"ReadIf True, users can expand the window beyond its minimum size.
"allow_shrink"ReadIf True, the window has no minimum size.
"configure_notify_received"ReadIf True a window resize configuration event has been received.
"configure_request_count"ReadThe number of outstanding configuration requests.
"decorated"ReadIf True the window will have decorations like a titlebar, resize controls, etc. See the set_decorated() method.
"default_widget"ReadThe child widget that will be activated by default. See the set_default() method.
"destroy_with_parent"ReadIf True the window is destroyed when its transient parent is destroyed.
"focus_widget"ReadThe child widget that has the focus.
"frame"ReadThe frame gtk.gdk.Window (if any). See the set_has_frame() and set_frame_dimensions() methods.
"frame_bottom"ReadThe height of the bottom frame border. See the set_frame_dimensions() and set_has_frame() methods.
"frame_left"ReadThe width of the left frame border. See the set_frame_dimensions() and set_has_frame() methods.
"frame_right"ReadThe width of the right frame border. See the set_frame_dimensions() and set_has_frame() methods.
"frame_top"ReadThe height of the top frame border. See the set_frame_dimensions() and set_has_frame() methods.
"gravity"ReadThe window's gravity. See the move() and set_gravity() methods.
"group"ReadThe gtk.WindowGroup (if any) the window belongs to.
"has_focus"ReadIf True the window has the focus.
"has_frame"ReadIf True the window has a frame window. See the set_has_frame() method.
"has_user_ref_count"ReadIf True the window has not been destroyed.
"iconify_initially"ReadIf True the window has been iconified by a call to the iconify() method.
"keys_changed_handler"ReadThe idle handler ID for handling accelerator group changes.
"maximize_initially"ReadIf True the window has been maximized by a call to the maximize() method.
"mnemonic_modifier"ReadThe mnemonic modifier used with a key to activate an accelerator. See the set_mnemonic_modifier() method
"modal"ReadIf True the window is modal. See the set_modal() method.
"need_default_position"ReadIf True the window needs an initial position calculated.
"need_default_size"ReadIf True the window needs an initial size calculated.
"position"ReadThe initial position of the window. See the set_position() method.
"stick_initially"ReadIf True the window has been made sticky by a call to the stick() method.
"title"ReadThe title of the window.
"transient_parent"ReadThe transient parent window. See the set_transient_for() method.
"type"ReadThe type of the window: gtk.WINDOW_TOPLEVEL or gtk.WINDOW_POPUP.
"type_hint"ReadThe window's type hint. See the set_type_hint() method.
"wmclass_class"ReadThe window system class hint. See the set_wmclass() method.
"wmclass_name"ReadThe window system name hint. See the set_wmclass() method.
"wm_role"ReadThe unique identifier for the window. See the set_role() method.

gtk.Window Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

"activate-default"

def callback(window, user_param1, ...)

"activate-focus"

def callback(window, user_param1, ...)

"frame-event"

def callback(window, event, user_param1, ...)

"keys-changed"

def callback(window, user_param1, ...)

"move-focus"

def callback(window, direction, user_param1, ...)

"set-focus"

def callback(window, widget, user_param1, ...)

Description

A gtk.Window provides a widget that users commonly think of as a window. That is, an area of the display that is managed by the window manager and usually decorated with a title bar, and items to allow the user to close, resize and move the window. PyGTK provides two types of windows (see the GTK Window Type Constants section for more information):

gtk.WINDOW_TOPLEVEL

A window that has no parent and usually has a frame and decorations supplied by a window manager. Toplevels windows are the main application window and dialogs.

gtk.WINDOW_POPUP

A window that is ignored by the window manager and has no frame or decorations. A popup window is used for menus and tooltips.

Typically, applications only directly create and use toplevel windows.

A gtk.Window is a container (subclass of gtk.Bin) holding one child widget.

Constructor

    gtk.Window(type=gtk.WINDOW_TOPLEVEL)

type :

the type of window: gtk.WINDOW_TOPLEVEL or gtk.WINDOW_POPUP

Returns :

a new gtk.Window.

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.WINDOW_TOPLEVEL (see the GTK Window Type Constants for more details). gtk.WINDOW_POPUP is used to create 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 the set_decorated() method with a toplevel window, don't use a popup window.

Methods

gtk.Window.set_title

    def set_title(title)

title :

the title of the window

The set_title() method sets the "title" property of the gtk.Window to the value specified by title. 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.

gtk.Window.get_title

    def get_title()

Returns :

the title of the window, or None.

The get_title() method returns the value of the "title" property of the window. See the set_title() method.

gtk.Window.set_wmclass

    def set_wmclass(wmclass_name, wmclass_class)

wmclass_name :

the window name hint

wmclass_class :

the window class hint

The set_wmclass() method sets the X Window System "class" and "name" hints for a window. Applications should not call this method. According to the ICCCM, you should always set these to the same value for all windows in an application, and PyGTK sets them to that value by default, so calling this method is sort of pointless. However, you may want to call the set_role() method 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.

gtk.Window.set_role

    def set_role(role)

role :

a unique identifier for the window

The set_role() method sets a unique identifier (specified by role) for the window to be used when restoring a session. This method is only useful on X11. 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.d

gtk.Window.get_role

    def get_role()

Returns :

the role of the window if set, or None.

The get_role() method returns the role of the window. See the set_role() method for further explanation.

gtk.Window.add_accel_group

    def add_accel_group(accel_group)

accel_group :

a gtk.AccelGroup

The add_accel_group() method associates the accelerator group specified by accel_group with the window.

gtk.Window.remove_accel_group

    def remove_accel_group(accel_group)

accel_group :

a gtk.AccelGroup

The remove_accel_group() method dissociates the accelerator group specified by accel_group from the widget. This method reverses the effects of the add_accel_group() method.

gtk.Window.set_position

    def set_position(position)

position :

a position constraint.

The set_position() method sets the "window-position" property to the value of position. The value of position must be one of the GTK Window Position Constants.

If the old or new window position constraint is gtk.WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

gtk.Window.activate_focus

    def activate_focus()

Returns :

True if the window has a focus widget

The activate_focus() method activates the child widget with the focus. This method returns True if the window has a widget with the focus.

gtk.Window.set_focus

    def set_focus(focus)

focus :

the widget to be the new focus widget or None to unset a focus widget

The set_focus() method sets the widget specified by focus to be the focus widget for the window. If focus is None the window's focus widget is unset. To set the focus to a particular widget in the toplevel, it is usually more convenient to use the gtk.Widget.grab_focus() method instead of this method.

gtk.Window.get_focus

    def get_focus()

Returns :

the currently focused widget.

The get_focus() method returns the current focused widget within the window. The focus widget is the widget that would have the focus if the toplevel window is focused.

gtk.Window.set_default

    def set_default(default_widget)

default_widget :

the widget to be the default, or None to unset the default widget.

The set_default() method sets the window's default widget to the value specified by default_widget. If default_widget is None the window's default widget is unset. The default widget is the widget that's activated when the user presses Enter in a window. When setting (rather than unsetting) the default widget it's generally easier to call the gtk.Widget.grab_default() method on the widget. Before making a widget the default widget, you must set the gtk.CAN_DEFAULT flag on the widget you'd like to make the default using the gtk.Object.set_flags() method.

gtk.Window.activate_default

    def activate_default()

Returns :

True if the window has a default widget or a focus widget.

The activate_default() method activates the default widget. If there is no default widget or the default widget cannot be activated, the window's focus widget (if any) is activated. This method returns False if no default widget could be activated or there is no focus widget.

gtk.Window.set_transient_for

    def set_transient_for(parent)

parent :

the parent window or None to remove the transient parent

The set_transient_for() method sets the window as a transient window for the window specified by parent. Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to keep the dialog on top of the main window, or center the dialog over the main window. The gtk.Dialog() constructor and other convenience functions in PyGTK will sometimes call the set_transient_for() method on your behalf.

On Windows, this method will and put the child window on top of the parent, much as the window manager would have done on X.

gtk.Window.get_transient_for

    def get_transient_for()

Returns :

the transient parent for this window, or None if no transient parent has been set.

The get_transient_for() method returns the transient parent for this window or None if no transient window is set. See the set_transient_for() method.

gtk.Window.set_type_hint

    def set_type_hint(hint)

hint :

the window type

The set_type_hint() method sets the window type hint for the window to the value specified by hint. The value of hint must be one of the GDK Window Type Hint Constants.

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 method of the window in your application. This method should be called before the window becomes visible. The gtk.Dialog() constructor and other convenience functions in PyGTK will sometimes call this method on your behalf.

gtk.Window.get_type_hint

    def get_type_hint()

Returns :

the type hint for the window.

The get_type_hint() method returns the type hint for this window. See the set_type_hint() method.

gtk.Window.set_destroy_with_parent

    def set_destroy_with_parent(setting)

setting :

if True destroy the window with its transient parent

The set_destroy_with_parent() method sets the "destroy-with-parent" property to the value specified by setting. If setting is True, destroying the transient parent of the window will also destroy the window itself. This is useful for dialogs that shouldn't persist beyond the lifetime of the main window they're associated with.

gtk.Window.get_destroy_with_parent

    def get_destroy_with_parent()

Returns :

True if the window will be destroyed with its transient parent.

The get_destroy_with_parent() method returns the value of the "destroy-with-parent" property that determines if the window will be destroyed with its transient parent. See the set_destroy_with_parent() method.

gtk.Window.set_resizable

    def set_resizable(resizable)

resizable :

if True the user can resize this window

The set_resizable() method sets the "resizable" property to the value of resizable. If resizable is True the user can resize the window. Windows are user resizable by default.

gtk.Window.get_resizable

    def get_resizable()

Returns :

True if the user can resize the window

The get_resizable() method returns the value of the "resizable" property. See the set_resizable() method.

gtk.Window.set_gravity

    def set_gravity(gravity)

gravity :

the window gravity

The set_gravity() method sets the gravity of the window to the value specified by gravity. The window gravity defines the meaning of coordinates passed to the move() method. The value of gravity must be one of the GDK Gravity Constants.

The default window gravity is gtk.gdk.GRAVITY_NORTH_WEST which will typically "do what you want."

gtk.Window.get_gravity

    def get_gravity()

Returns :

the window gravity

The get_gravity() method returns window gravity. See the set_gravity() method.

gtk.Window.set_geometry_hints

    def set_geometry_hints(geometry_widget, min_width=-1, min_height=-1, max_width=-1, max_height=-1, base_width=-1, base_height=-1, width_inc=-1, height_inc=-1, min_aspect=-1.0, max_aspect=-1.0)

geometry_widget :

the widget the geometry hints will be applied to

min_width :

the minimum width of window (or -1 to use requisition)

min_height :

the minimum height of window (or -1 to use requisition)

max_width :

the maximum width of window (or -1 to use requisition)

max_height :

the maximum height of window (or -1 to use requisition)

base_width :

allowed window widths are base_width + width_inc * N where N is any integer

base_height :

allowed window heights are base_height + width_inc * N where N is any integer

width_inc :

the width resize increment

height_inc :

the height resize increment

min_aspect :

the minimum width to height ratio

max_aspect :

the maximum width to height ratio

The set_geometry_hints() method sets up hints about how a window can be resized by the user. You can set the minimum and maximum widths and heights, the base width and height for resizing, the allowed width and height resize increments (e.g. for xterm, you can only resize by the size of a character), and the minimum and maximum aspect ratios. If geometry_widget is not None it specifies the widget to figure the geometry on.

gtk.Window.set_screen

    def set_screen(screen)

screen :

a gtk.gdk.Screen.

Note

This method is available in PyGTK 2.2 and above.

The set_screen() method sets the "screen" property to the gtk.gdk.Screen specified by screen. The "screen" property contains the screen that the window is displayed on. If the window is already mapped, it will be unmapped, and then remapped on the new screen.

gtk.Window.get_screen

    def get_screen()

Returns :

a gtk.gdk.Screen.

Note

This method is available in PyGTK 2.2 and above.

The get_screen() method returns the gtk.gdk.Screen that the window is displayed on.

gtk.Window.is_active

    def is_active()

Returns :

True if the window is part of the current active window.

Note

This method is available in PyGTK 2.4 and above.

The is_active() method returns True if the window is part of the current active toplevel, i.e., the toplevel window receiving keystrokes. The return value is True if the window is active the toplevel itself, or if it is, for example, a gtk.Plug embedded in the active toplevel. You might use this method if you wanted to draw a widget differently in an active window from a widget in an inactive window. See the has_toplevel_focus() method.

gtk.Window.has_toplevel_focus

    def has_toplevel_focus()

Returns :

True if the the input focus is within the window

Note

This method is available in PyGTK 2.4 and above.

The has_toplevel_focus() method returns True if the input focus is within the window. For real toplevel windows, this is identical to is_active(), but for embedded windows, like a gtk.Plug, the results will differ.

gtk.Window.set_has_frame

    def set_has_frame(setting)

setting :

if True PyGTK draws the window border

The set_has_frame() method sets the flag that causes PyGTK to draw its own window border for the window.

Note

This is a special-purpose method for the framebuffer port. For most applications, you want the set_decorated() method instead,that tells the window manager whether to draw the window border.

If this method is called on a window with setting of True, before it is realized or showed, it will have a "frame" window around the window's gtk.gdk.Window, accessible in the window's frame. Using the signal "frame-event" you can receive all events targeted at the frame. This method is used by the linux-fb port to implement managed windows, but it could conceivably be used by X-programs that want to do their own window decorations.

gtk.Window.get_has_frame

    def get_has_frame()

Returns :

True if a frame has been added to the window via the set_has_frame() method.

The get_has_frame() method returns the value of the window's "has_frame" flag that determines if the window has a frame window exterior to its gtk.gdk.Window. See the set_has_frame() method for more information.

gtk.Window.set_frame_dimensions

    def set_frame_dimensions(left, top, right, bottom)

left :

the width of the left border

top :

the height of the top border

right :

the width of the right border

bottom :

the height of the bottom border

The set_frame_dimensions() method sets the size of the frame around the window to the values specified by left, top, bottom and right.

Note

This is a special-purpose method intended for the framebuffer port. See the set_has_frame() method. It will have no effect on the window border drawn by the window manager, which is the normal case when using the X Window system.

For windows with frames (see the set_has_frame() method) this method can be used to change the size of the frame border.

gtk.Window.get_frame_dimensions

    def get_frame_dimensions()

Returns :

a tuple containing the frame dimensions: the width of the frame at the left; the height of the frame at the top; the width of the frame at the right; and, the height of the frame at the bottom.

The get_frame_dimensions() method returns a tuple containing the frame dimensions: the width of the frame at the left; the height of the frame at the top; the width of the frame at the right; and, the height of the frame at the bottom.

Note

This is a special-purpose method intended for the framebuffer port See the set_has_frame() method. It will not return the size of the window border drawn by the window manager, which is the normal case when using a windowing system. See the get_frame_extents() to get the standard window border extents.

See the set_has_frame() and set_frame_dimensions() methods for more information.

gtk.Window.set_decorated

    def set_decorated(setting)

setting :

if True decorate the window

The set_decorated() method sets the decorated flag to the value specified by setting. If setting is True the window will be decorated. By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow PyGTK to disable these decorations, creating a borderless window. If you set the decorated property to False using this method, PyGTK will do its best to convince the window manager not to decorate the window. On Windows, this method always works, since there's no window manager policy involved.

gtk.Window.get_decorated

    def get_decorated()

Returns :

True if the window has been set to have decorations

The get_decorated() method returns the value of the decorated flag that determines if the window has been set to have decorations such as a title bar. See the set_decorated() method.

gtk.Window.set_icon_list

    def set_icon_list(...)

... :

zero or more gtk.gdk.Pixbuf objects

The set_icon_list() method sets up the icon representing the window using the set of gtk.gdk.Pixbuf objects passed as arguments. If no gtk.gdk.Pixbuf objects are passed in the icon is unset and reverts to the default icon. 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. This method allows you to pass in the same icon in several hand-drawn sizes. The gtk.gdk.Pixbuf objects should contain the natural sizes your icon is available in; i.e., don't scale the image before passing it to PyGTK. 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. The recommended sizes to provide are: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them.

See the gtk.window_set_default_icon_list() function 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 the set_transient_for() method) will inherit their icon from their transient parent. So there's no need to explicitly set the icon on transient windows.

gtk.Window.get_icon_list

    def get_icon_list()

Returns :

a copy of the window's icon list

The get_icon_list() method returns the list of icons set by the set_icon_list() method.

gtk.Window.set_icon

    def set_icon(icon)

icon :

an icon image, or None

The set_icon() method sets the "icon" property to the value specified by icon. 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. The icon should be provided in whatever size it was naturally drawn; that is, don't scale the image before passing it to PyGTK. 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 the set_icon_list() method. Then the best size will be used.

This method is equivalent to calling the set_icon_list() method with a 1-element list. See the gtk.window_set_default_icon_list() function to set the icon for all windows in your application in one go.

gtk.Window.set_icon_from_file

    def set_icon_from_file(filename)

filename :

the name of a file containing an icon image

Returns :

True if the icon was loaded.

The set_icon_from_file() method sets the "icon" property to the icon loaded from the file specified by filename. The icon is used when the window is minimized (also known as iconified). See the set_icon()) method for more information. This method is equivalent to calling the set_icon() method with a pixbuf created by loading the image from filename.

The GError exception is raised if an error occurs while loading the pixbuf from filename.

gtk.Window.get_icon

    def get_icon()

Returns :

the icon for window

The get_icon() method returns the value of the "icon" property set by the set_icon() (or if you've called the set_icon_list() method, returns the first icon in the icon list).

gtk.Window.set_modal

    def set_modal(modal)

modal :

if True the window is modal

The set_modal() method sets the "modal" property to the value of modal. If modal is True the window becomes modal. Modal windows prevent interaction with other windows in the same application. Typically modal windows are used for gtk.Dialog windows that require a user response before the application can continue. To keep modal dialogs on top of the main application windows, use the set_transient_for() method to make the dialog transient for the parent - most window managers will then disallow lowering the dialog below the parent.

gtk.Window.get_modal

    def get_modal()

Returns :

True if the window is set to be modal and establishes a grab when shown

The get_modal() method returns the value of the "modal" property. If "modal" is True the window is modal. See the set_modal() method.

gtk.Window.add_mnemonic

    def add_mnemonic(keyval, target)

keyval :

the mnemonic key

target :

the widget that gets activated by the mnemonic

The add_mnemonic() method adds a mnemonic key specified by keyval to this window. When the mnemonic key is pressed the widget specified by target will be activated.

gtk.Window.remove_mnemonic

    def remove_mnemonic(keyval, target)

keyval :

the mnemonic key

target :

the widget that gets activated by the mnemonic

The remove_mnemonic() method removes the mnemonic specified by keyval for the widget specified by target from this window.

gtk.Window.mnemonic_activate

    def mnemonic_activate(keyval, modifier)

keyval :

the mnemonic key

modifier :

the modifiers

Returns :

True if the activation was done

The mnemonic_activate() method activates the targets associated with the mnemonic specified by keyval. The window's mnemonic modifier must match modifier to allow the activation to proceed. See the set_mnemonic_modifier() method for more information.

gtk.Window.set_mnemonic_modifier

    def set_mnemonic_modifier(modifier)

modifier :

the modifier mask used to activate mnemonics on this window.

The set_mnemonic_modifier() method sets the mnemonic modifier for this window to the value specified by modifier. The value of modifier is one of:

gtk.gdk.SHIFT_MASK

The Shift key.

gtk.gdk.CONTROL_MASK

The Control key.

gtk.gdk.MOD1_MASK

The fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key).

gtk.Window.get_mnemonic_modifier

    def get_mnemonic_modifier()

Returns :

the modifier mask used to activate mnemonics on this window.

The get_mnemonic_modifier() method returns the mnemonic modifier for this window. See the set_mnemonic_modifier() method for more detail.

gtk.Window.activate_key

    def activate_key(event)

event :

a gtk.gdk.Event

Returns :

True if a mnemonic or accelerator was found and activated.

Note

This method is available in PyGTK 2.4 and above.

The activate_key() method activates mnemonics and accelerators for the window. This is normally called by the default gtk.Widget "key-press-event" signal 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.

gtk.Window.propagate_key_event

    def propagate_key_event(event)

event :

a gtk.gdk.Event

Returns :

True if a widget in the focus chain handled the event.

Note

This method is available in PyGTK 2.4 and above.

The propagate_key_event() method propagates a key press or release event to the focus widget and up the focus container chain until a widget handles the key event specified by event. This is normally called by the default gtk.Widget "key-press-event" and "key-release-event" signal 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.

gtk.Window.present

    def present()

The present() method 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 the window is hidden, this method calls the the gtk.Widget.show() method as well. This method 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 the present() method to move the already-open dialog where the user can see it.

gtk.Window.iconify

    def iconify()

The iconify() method asks the window manager to iconify (i.e. minimize) the specified the window. 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. This method can be called before showing a window, in which case the window will be iconified before it ever appears on-screen. You can track iconification via the gtk.Widget "window-state-event" signal.

gtk.Window.deiconify

    def deiconify()

The deiconify() method asks the window manager to deiconify (i.e. unminimize) the specified the window. 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 gtk.Widget "window-state-event" signal.

gtk.Window.stick

    def stick()

The stick() method asks the window manager to stick the window, 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. This method can be called before showing a window. You can track stickiness via the gtk.Widget "