### Navigation

- index
- modules |
- next |
- previous |
- PySDL2 0.9.2 documentation »
- API reference »
- sdl2.ext - Python extensions for SDL2 »

# Window routines to manage on-screen windows

class `sdl2.ext.``Window`(title : string, size : iterable[, position=None[, flags=None]])

  The Window class represents a visible on-screen object with an optional border and title text. It represents an area on the screen that can be accessed by the application for displaying graphics and receive and process user input.

  The position to show the Window at is undefined by default, letting the operating system or window manager pick the best location. The behaviour can be adjusted through the `DEFAULTPOS` class variable.

      Window.DEFAULTPOS = (10, 10)

  The created Window is hidden by default, which can be overridden at the time of creation by providing other SDL window flags through the flags parameter. The default flags for creating Window instances can be adjusted through the `DEFAULTFLAGS` class variable.

      Window.DEFAULTFLAGS = sdl2.SDL_WINDOW_SHOWN

  `window`

    The used `sdl2.SDL_Window`.

  `title`

    The title of the `Window`.

  `size`

    The size of the `Window`.

  `show`() → None

    Show the `Window` on the display.

  `hide`() → None

    Hide the `Window`.

  `maximize`() → None

    Maximizes the `Window` to the display’s dimensions.

  `minimize`() → None

    Minimizes the `Window` to an iconified state in the system tray.

  `refresh`() → None

    Refreshes the entire `Window` surface.

    Note

    This only needs to be called, if a SDL_Surface was acquired via `get_surface()` and is used to display contents.

  `get_surface`() → SDL_Surface

    Gets the `sdl2.SDL_Surface` used by the `Window` to display 2D pixel data.

    Note

    Using this method will make the usage of GL operations, such as texture handling or the usage of SDL renderers impossible.

### Navigation

- index
- modules |
- next |
- previous |
- PySDL2 0.9.2 documentation »
- API reference »
- sdl2.ext - Python extensions for SDL2 »