Source

pygame / doc / src / sdl_constants.rst

:mod:`pygame2.sdl.constants` -- Constants for SDL

This module contains the constants used throughout the :mod:`pygame2.sdl` modules.

Initialisation Constants

Those constants are used by the :func:`pygame2.sdl.init`, :func:`pygame2.sdl.init_subsystem` and :func:`pygame2.sdl.quit_subsystem` functions.

Blending Constants

Those constants are used by the :meth:`pygame2.sdl.video.Surface.blit` and :meth:`pygame2.sdl.video.Surface.fill` methods.

If not stated otherwise, each of the modes will work on a per-channel basis, so that the described operation is performed on each RGB(A) color component. This means that e.g. BLEND_RGB_ADD performs some operation similar to (R1 + R1, G1 + G2, B1 + B2).

CD-ROM Constants

The following constants are used by the :mod:`pygame2.sdl.cdrom` module.

The following constants are used by the :attr:`pygame2.sdl.cdrom.CDTrack.type` attribute.

The following constants are used by the :attr:`pygame2.sdl.cdrom.CD.status` attribute:

Event Constants

Those constants are used by the :mod:`pygame2.sdl.event` module functions.

Application Constants

Those constants are used by the :data:`ACTIVEEVENT` event and the :func:`pygame2.sdl.event.get_app_state` method.

Keyboard Constants

The following constants are used by the :func:`pygame2.sdl.keyboard.set_repeat` function:

The following constants are used by the :func:`pygame2.sdl.keyboard.get_state` and :func:`pygame2.sdl.keyboard.get_key_name` functions and the :data:`KEYDOWN` and :data:`KEYUP` events.

Constant Meaning and Value
K_UNKNOWN An unknown key.
K_a - K_z Alphabetical keys ranging from a to z. There is no captalised version of them. Instead the keyboard modifier state can be checked for :data:`KMOD_SHIFT` being set.
K_0 - K_9 Numerical keys ranging from 0 to 9. Those differ from the numerical keys on the keypad.
K_TAB, K_SPACE, K_EXCLAIM, K_HASH, K_QUOTEDBL, K_DOLLAR, K_QUOTE, K_AMPERSAND, K_LEFTPAREN, K_RIGHTPAREN, K_ASTERISK, K_PLUS, K_MINUS, K_COMMA, K_PERIOD, K_SLASH, K_BACKSLASH, K_COLON, K_SEMICOLON, K_QUESTION, K_AT, K_LEFTBRACKET, K_RIGHTBRACKET, K_CARET, K_UNDERSCORE, K_BACKQUOTE Tabulator, Space, Exclamation Mark, Hash, Double Quote, Dollar sign, Single Quote, Ampersand, Left and Right Parenthesis, Asterisk, Plus and Minus, Comma, Period, Slash and Backslash, Colon and Semicolon, Question Mark, At sign, Left and Right Bracket, Caret, Underscore and Backquote keys.
K_LESS, K_GREATER, K_EQUALS Less, Greater and Equality sign keys.
K_F1 - K_F15 Function keys from F1 to F15.
K_HOME, K_END, K_INSERT, K_DELETE, K_PAGEUP, K_PAGEDOWN, K_BACKSPACE Home and End, Insert and Delete, PageUp and PageDown and Backspace keys.
K_LEFT, K_RIGHT, K_DOWN, K_UP Cursor keys.
K_KP0 - K_KP9 Numerical keys on the keypad, ranging from 0 to 9.
K_KP_PERIOD, K_KP_DIVIDE, K_KP_MULTIPLY, K_KP_MINUS, K_KP_PLUS, K_KP_EQUALS, K_KP_ENTER Period, Divide, Multiply, Plus, Minus, Equal sign and the Enter key on the keypad.
K_HELP, K_PRINT, K_SYSREQ, K_BREAK, K_MENU, K_POWER, K_EURO, K_FIRST, K_LAST Help, Print, SysReq, Break, Menu, Power, Euro sign, First and Last keys.
K_ESCAPE, K_PAUSE, K_CLEAR Escape, Pause and Clear keys.
K_NUMLOCK, K_CAPSLOCK, K_SCROLLOCK NumLock, CapsLock and ScrolLock keys.
K_RSHIFT, K_LSHIFT, K_RCTRL, K_LCTRL, K_RALT, K_LALT, K_RMETA, K_LMETA, K_LSUPER, K_RSUPER, K_MODE Right and Left Shift, Right and Left Control, Right and Left Alternative, Right and Left Meta, Right and Left Super and Mode keys.

The following constants are keyboard modifer states, used as bitwise combinations to check, whether they were hold down on keyboard input. They are used by the :func:`pygame2.sdl.keyboard.get_mod_state` and :func:`pygame2.sdl.keyboard.set_mod_state` functions.

Constant Meaning and Value
KMOD_NONE No modifier key was pressed.
KMOD_LSHIFT, KMOD_RSHIFT, KMOD_SHIFT Left Shift, Right Shift or one of both was pressed.
KMOD_LCTRL, KMOD_RCTRL, KMOD_CTRL Left Control, Right Contro or one of both was pressed.
KMOD_LALT, KMOD_RALT, KMOD_ALT Left Alternative, Right Alternative or one of both was pressed.
KMOD_LMETA, KMOD_RMETA, KMOD_META Left Meta, Right Met or one of both was pressed.
KMOD_NUM, KMOD_CAPS, KMOD_MODE NumLock, CapsLock or Mode was pressed.

Overlay Types

The :class:`pygame2.sdl.video.Overlay` class supports the following video overlay types.

Surface Flags

The flags explained below are used by the :class:`pygame2.sdl.video.Surface` class and various :mod:`pygame2.sdl.video` functions. Not all of them are however used or applicable to both, the module functions and the class itself. Using them, although not supported by the one or other, will not result in an error, instead the inappropriate flags are silently ignored.

Various Constants