Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.platform.sdl2.Application class

SDL2 application

Classes

class Configuration
Configuration
class ExitEvent
Exit event
class GLConfiguration
OpenGL context configuration
class InputEvent
Base for input events
class KeyEvent
Key event
class PointerEvent
Pointer event
class PointerMoveEvent
Pointer move event
class ScrollEvent
Scroll event
class ViewportEvent
Viewport event

Enums

class Cursor: ARROW = 0 TEXT_INPUT = 1 CROSSHAIR = 3 WAIT_ARROW = 4 RESIZE_NWSE = 5 RESIZE_NESW = 6 RESIZE_WE = 7 RESIZE_NS = 8 RESIZE_ALL = 9 NO = 10 HAND = 11 HIDDEN = 12 HIDDEN_LOCKED = 13
Cursor type
class Key: UNKNOWN = 0 LEFT_SHIFT = 1073742049 RIGHT_SHIFT = 1073742053 LEFT_CTRL = 1073742048 RIGHT_CTRL = 1073742052 LEFT_ALT = 1073742050 RIGHT_ALT = 1073742054 LEFT_SUPER = 1073742051 RIGHT_SUPER = 1073742055 ENTER = 13 ESC = 27 UP = 1073741906 DOWN = 1073741905 LEFT = 1073741904 RIGHT = 1073741903 HOME = 1073741898 END = 1073741901 PAGE_UP = 1073741899 PAGE_DOWN = 1073741902 BACKSPACE = 8 INSERT = 1073741897 DELETE = 127 F1 = 1073741882 F2 = 1073741883 F3 = 1073741884 F4 = 1073741885 F5 = 1073741886 F6 = 1073741887 F7 = 1073741888 F8 = 1073741889 F9 = 1073741890 F10 = 1073741891 F11 = 1073741892 F12 = 1073741893 SPACE = 32 TAB = 9 QUOTE = 39 COMMA = 44 PERIOD = 46 MINUS = 45 PLUS = 43 SLASH = 47 PERCENT = 37 SEMICOLON = 59 EQUAL = 61 LEFT_BRACKET = 91 RIGHT_BRACKET = 93 BACKSLASH = 92 BACKQUOTE = 96 ZERO = 48 ONE = 49 TWO = 50 THREE = 51 FOUR = 52 FIVE = 53 SIX = 54 SEVEN = 55 EIGHT = 56 NINE = 57 A = 97 B = 98 C = 99 D = 100 E = 101 F = 102 G = 103 H = 104 I = 105 J = 106 K = 107 L = 108 M = 109 N = 110 O = 111 P = 112 Q = 113 R = 114 S = 115 T = 116 U = 117 V = 118 W = 119 X = 120 Y = 121 Z = 122 NUM_ZERO = 1073741922 NUM_ONE = 1073741913 NUM_TWO = 1073741914 NUM_THREE = 1073741915 NUM_FOUR = 1073741916 NUM_FIVE = 1073741917 NUM_SIX = 1073741918 NUM_SEVEN = 1073741919 NUM_EIGHT = 1073741920 NUM_NINE = 1073741921 NUM_DECIMAL = 1073742044 NUM_DIVIDE = 1073741908 NUM_MULTIPLY = 1073741909 NUM_SUBTRACT = 1073741910 NUM_ADD = 1073741911 NUM_ENTER = 1073741912 NUM_EQUAL = 1073741927
Key
class Modifier: SHIFT = 3 CTRL = 192 ALT = 768 SUPER = 3072
Keyboard modifier
class Pointer: MOUSE_LEFT = 1 MOUSE_MIDDLE = 2 MOUSE_RIGHT = 4 MOUSE_BUTTON4 = 8 MOUSE_BUTTON5 = 16 FINGER = 32
Pointer
class PointerEventSource: MOUSE = 0 TOUCH = 1
Pointer event source

Methods

def draw_event(self, /) -> None
Draw event
def exec(self, /) -> int
Execute application main loop
def exit(self, arg0: int, /) -> None
Exit application main loop
def exit_event(self, arg0: ExitEvent, /) -> None
Exit event
def key_press_event(self, arg0: KeyEvent, /) -> None
Key press event
def key_release_event(self, arg0: KeyEvent, /) -> None
Key release event
def main_loop_iteration(self, /) -> bool
Run one iteration of application main loop
def pointer_move_event(self, arg0: PointerMoveEvent, /) -> None
Pointer move event
def pointer_press_event(self, arg0: PointerEvent, /) -> None
Pointer press event
def pointer_release_event(self, arg0: PointerEvent, /) -> None
Pointer release event
def redraw(self, /) -> None
Redraw immediately
def scroll_event(self, arg0: ScrollEvent, /) -> None
Scroll event
def swap_buffers(self, /) -> None
Swap buffers
def viewport_event(self, arg0: ViewportEvent, /) -> None
Viewport event
def warp_cursor(self, arg0: Vector2i, /) -> None
Warp mouse cursor to given coordinates

Special methods

def __init__(self, configuration: Configuration = <magnum.platform.sdl2.Application.Configuration object at 0x7c0068db5170>, gl_configuration: GLConfiguration = <magnum.platform.sdl2.Application.GLConfiguration object at 0x7c00682e4df0>) -> None
Constructor

Properties

cursor: Cursor get set
Cursor type
dpi_scaling: Vector2 get
DPI scaling
framebuffer_size: Vector2i get
Framebuffer size
swap_interval: int get set
Swap interval
window_size: Vector2i get
Window size