displaydev.sdldisplay
displaydev.sdldisplay — SDL2 desktop display driver.
- displaydev.sdldisplay.poll_event()[source]
Poll for one pending event.
- Returns:
Optional[events] – One events event, or
None.
- displaydev.sdldisplay.get_events()[source]
Drain all pending events from the SDL queue.
- Returns:
list | None – A list of events, or
Noneif the queue was empty.
- class displaydev.sdldisplay.SDLDisplay(width=320, height=240, rotation=0, color_depth=16, title='SDL2 Display', scale=1.0, window_flags=4, render_flags=6, x=805240832, y=805240832, *, quiet=False)[source]
Bases:
FrameRecorderMixin,DesktopDisplayEmulate an LCD window with SDL2 (via
usdl2).Provides scrolling and rotation similar to a panel driver. The SDL texture acts as the LCD’s internal memory. Scale is reduced automatically when the window would not fit the desktop work area.
- Parameters:
width (int, optional) – Panel width in pixels. Defaults to 320.
height (int, optional) – Panel height in pixels. Defaults to 240.
rotation (int, optional) – Rotation in degrees. Defaults to 0.
color_depth (int, optional) – Bits per pixel (16/24/32). Defaults to 16.
title (str, optional) – Window title. Defaults to
"SDL2 Display".scale (float, optional) – Window scale factor. Defaults to 1.0.
window_flags (int, optional) –
SDL_WINDOW_*flags.render_flags (int, optional) –
SDL_RENDERER_*flags.x (int, optional) – Window X (default centered).
y (int, optional) – Window Y (default centered).
quiet (bool) – Suppress init chatter when True.
- blit_rect(buffer, x, y, w, h)[source]
Blit a buffer into the display texture. Compositing is deferred until
show().
- fill_rect(x, y, w, h, c)[source]
Fill a rectangle in the display texture. Compositing is deferred until
show().