sdl2.ext.window - Window routines to manage on-screen windows

Window routines to manage on-screen windows.

class sdl2.ext.window.Window(title, size, position=None, flags=None)

Bases: object

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.

DEFAULTFLAGS = 8
DEFAULTPOS = (536805376, 536805376)
__init__(title, size, position=None, flags=None)

Create a Window with a specific size and title.

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.video.SDL_WINDOW_SHOWN
window

sdl2.SDL_Window – The used SDL_Window.

get_surface()

Get the SDL_Surface used by the Window to display 2D pixel data.

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

Returns:sdl2.SDL_Surface
hide()

Hide the window.

maximize()

Maximize the window to the display’s dimensions.

minimize()

Minimize the window to an iconified state in the system tray.

refresh()

Refresh the entire window surface.

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

show()

Show the window on the display.

size

The size of the window.

title

The title of the window.

sdl2.ext.window.get_display_mode(index=0)

Get information about the desktop display mode.

Parameters:index (int) – the index of the display to query. default to 0.
Returns:tuple