pygame2.sdl – basic SDL wrapper module

Basic Pygame2 SDL wrapper module

Module Functions

pygame2.sdl.get_compiled_version() -> (int, int, int)

Gets the SDL version pygame2 was compiled against as three-value tuple.

This version is built at compile time. It can be used to detect which features may not be available through Pygame, if it is used as precompiled package using a different version of the SDL library.

pygame2.sdl.get_error() → str

Gets the last SDL error message occured.

SDL maintains an internal error message. This message will usually be given to you when a pygame2.Error is raised.

You will rarely need to call this function.

pygame2.sdl.get_version() -> (int, int, int)

Gets the SDL version pygame2 currently uses as three-value tuple.

This version is detected at runtime. It can be used to detect which features may not be available through Pygame, if it is used as precompiled package using a different version of the SDL library.

pygame2.sdl.init(flags) → bool

Initializes the underlying SDL library.

Initializes the underlying SDL library using the passed SDL flags. The flags indicate, which subsystems of SDL should be initialized and can be a bitwise combination of the initialization constants of the pygame2.sdl.constants module.

In case an error occured, False will be returned. The detailled error can be received using get_error().

pygame2.sdl.init_subsystem(flags) → bool

Initializes one or more SDL subsystems.

In case a specific part of SDL was not initialized using init(), this function can be used to initialize it at a later time.

In contrast to the original SDL library, you do not need to call init() beforehand to initialize anything. In case it was not done before, init() will be called implicitly with the passed flags.

Note

Please be aware, that timers need a special treatment, which is not be met by using INIT_TIMER alone. For more details, take a look at the pygame2.sdl.time module documentation.

In case an error occured, False will be returned. The detailled error can be received using get_error().

pygame2.sdl.quit() → None

Shuts down all subsystems of the underlying SDL library.

After calling this function, you should not invoke any SDL related class, method or function as they are likely to fail or might give unpredictable results.

Note

Please be aware, that timers need a special treatment, which is not be met by using INIT_TIMER alone. For more details, take a look at the pygame2.sdl.time module documentation.

pygame2.sdl.quit_subsystem(flags) → None

Shuts down one or more subsystems of the underlying SDL library.

After calling this function, you should not invoke any class, method or function related to the specified subsystems as they are likely to fail or might give unpredictable results.

Note

Please be aware, that timers need a special treatment, which is not be met by using INIT_TIMER alone. For more details, take a look at the pygame2.sdl.time module documentation.

pygame2.sdl.was_init([flags]) → long

Gets a bitwise OR’ed combination of the initialized SDL subsystems.

Returns a bitwise combination of the currently initialized SDL subsystems. If flags is passed, only the listed subsystems in flags will be passed and the initialized ones of those returned.

Table Of Contents

Previous topic

pygame2.resources – Resource management methods.

Next topic

pygame2.sdl.audio – SDL audio subsystem wrapper

This Page