# enaml.widgets.window

Classes

`Window` | A top-level Window component.

class enaml.widgets.window.Window(parent=None, **kwargs)

  Bases: `Widget`

  A top-level Window component.

  A Window component is represents of a top-level visible component with a frame decoration. It may have at most one child widget which is dubbed the ‘central widget’. The central widget is an instance of Container and is expanded to fit the size of the window.

  A Window does not support features like MenuBars or DockPanes, for such functionality, use a MainWindow widget.

  windows = {}

    A static set of windows being used by the application. A window adds itself to this list when it is initialized, and removes itself when it is destroyed. This allows toplevel windows with no parent to persist without any other strong references.

  title

    The titlebar text.

  initial_position

    The initial position of the window frame. A value of (-1, -1) indicates that the toolkit should choose the initial position.

  initial_size

    The initial size of the window client area. A value of (-1, -1) indicates that the toolkit should choose the initial size.

  modality

    An enum which indicates the modality of the window. The default value is ‘non_modal’.

  destroy_on_close

    If this value is set to True, the window will be destroyed on the completion of the closed event.

  icon

    The title bar icon.

  always_on_top

    Whether the window stays on top of other windows on the desktop. Changes to this value after the window is shown will be ignored.

  closing

    An event fired when the user request the window to be closed. This will happen when the user clicks on the “X” button in the title bar button, or when the ‘close’ method is called. The payload will be a CloseEvent object which will allow code to veto the close event and prevent the window from closing.

  closed

    An event fired when the window is closed.

  visible

    Windows are invisible by default.

  proxy

    A reference to the ProxyWindow object.

  initialize()

    An overridden initializer method.

    This method adds the window to the static set of Windows.

  destroy()

    An overridden destructor method.

    This method removes the window from the static set of Windows.

  central_widget()

    Get the central widget defined on the window.

    The last Container child of the window is the central widget.

  position()

    Get the position of the window frame.

    Returns:

      result – The current position of the window frame.

    Return type:

      Pos

  set_position(pos)

    Set the position of the window frame.

    Parameters:

      pos (Pos) – The desired position of the window the window frame.

  size()

    Get the size of the window client area.

    Returns:

      result – The current size of the window client area.

    Return type:

      Size

  set_size(size)

    Set the size of the window client area.

    Parameters:

      size (Size) – The desired size of the window client area.

  geometry()

    Get the geometry of the window client area.

    Returns:

      result – The current geometry of the window client area.

    Return type:

      Rect

  set_geometry(rect)

    Set the geometry of the window client area.

    Parameters:

      rect (Rect) – The desired geometry of the window client area.

  frame_geometry()

    Get the geometry of the window frame.

    Returns:

      result – The current geometry of the window frame.

    Return type:

      Rect

  maximize()

    Maximize the window.

  is_maximized()

    Get whether the window is maximized.

  minimize()

    Minimize the window.

  is_minimized()

    Get whether the window is minimized.

  restore()

    Restore the window from a maximized or minimized state.

  send_to_front()

    Send the window to the top of the Z-order.

    This will only affect the Z-order of the window relative to the Z-order of other windows in the same application.

  send_to_back()

    Send the window to the bottom of the Z-order.

    This will only affect the Z-order of the window relative to the Z-order of other windows in the same application.

  activate_window()

    Set this window to be the active application window.

    This performs the same operation as clicking the mouse on the title bar of the window, except that it will not effect the Z order of the window.

    On Windows, this will cause the taskbar icon to flash if the window does not belong to the active application.

  center_on_screen()

    Center the window on the screen.

  center_on_widget(other)

    Center this window on another widget.

    Parameters:

      other (Widget) – The widget onto which to center this window.

  close()

    Close the window.

    This will cause the window to be hidden, the ‘closed’ event to be fired, and the window subsequently destroyed.

  show()

    Show the window to the screen.

    This is a reimplemented parent class method which will init and build the window hierarchy if needed.

  activated

    An event fired when an object’s proxy is activated. It is triggered once during the object lifetime, at the end of the activate_proxy method.