This module contains the constants used throughout the pygame2.sdl modules.
Those constants are used by the pygame2.sdl.init(), pygame2.sdl.init_subsystem() and pygame2.sdl.quit_subsystem() functions.
Those constants are used by the pygame2.sdl.video.Surface.blit() and 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).
The following constants are used by the pygame2.sdl.cdrom module.
The following constants are used by the pygame2.sdl.cdrom.CDTrack.type attribute.
The following constants are used by the pygame2.sdl.cdrom.CD.status attribute:
Those constants are used by the pygame2.sdl.event module functions.
Those constants are used by the ACTIVEEVENT event and the pygame2.sdl.event.get_app_state() method.
The following constants are used by the pygame2.sdl.keyboard.set_repeat() function:
The following constants are used by the pygame2.sdl.keyboard.get_state() and pygame2.sdl.keyboard.get_key_name() functions and the KEYDOWN and 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 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 pygame2.sdl.keyboard.get_mod_state() and 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. |
The pygame2.sdl.video.Overlay class supports the following video overlay types.
The flags explained below are used by the pygame2.sdl.video.Surface class and various 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.
Enables the use of asynchronous updates of the surface. This will usually slow down blitting on single CPU machines, but may provide a speedincrease on SMP systems.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. Passing ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its pixel depth.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
Enable hardware double buffering; only valid with HWSURFACE. Calling pygame2.sdl.video.Surface.flip() will flip the buffers and update the screen. All drawing will take place on the surface that is not displayed at the moment. If double buffering could not be enabled then pygame2.sdl.video.Surface.flip() will just perform a pygame2.sdl.video.Surface.update() on the entire screen.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
Create an OpenGL rendering context. You should have previously set OpenGL video attributes with pygame2.sdl.gl.set_attribute().
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
Create an OpenGL rendering context, like above, but allow normal blitting operations. The screen (2D) surface may have an alpha channel, and pygame2.sdl.video.Surface.update() must be used for updating changes to the screen surface.
Note
This option is kept for compatibility only, and is not recommended for new code.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
Create a resizable window. When the window is resized by the user a VIDEORESIZE event is generated and pygame2.sdl.video.set_mode() can be called again with the new size.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().
If possible, NOFRAME causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set.
This is only available for the pygame2.sdl.video functions and the display surface set by pygame2.sdl.video.set_mode().