displaydev.auto
Optional host backend selection. Backends never import this module.
Selects PSDisplay / JNDisplay / WinDisplay``→``PGDisplay``→
``SDLDisplay (or Android AndroidSDLDisplay) from the host so
board configs stay MCU-shaped wiring only. Explicit boards import a backend
directly; this factory is convenience only.
Returns the display driver directly. Desktop drivers expose get_events for
appdev.App(host_read=...).
The host backends are rows of the backends registry, so a backend of your
own can join them. See “Write your own backend” in docs/guides/displays.md.
- displaydev.auto.AutoDisplay(width=320, height=240, rotation=0, scale=1.0, title='displaydev', canvas_id=None, *, quiet=False, maximized=False, **kwargs)[source]
Construct a host-appropriate display driver.
- Parameters:
width – Forwarded to PG/SDL constructors (PS/JN ignore rotation/scale/title as their APIs dictate).
height – Forwarded to PG/SDL constructors (PS/JN ignore rotation/scale/title as their APIs dictate).
rotation – Forwarded to PG/SDL constructors (PS/JN ignore rotation/scale/title as their APIs dictate).
scale – Forwarded to PG/SDL constructors (PS/JN ignore rotation/scale/title as their APIs dictate).
title – Forwarded to PG/SDL constructors (PS/JN ignore rotation/scale/title as their APIs dictate).
canvas_id – PyScript canvas DOM id for the primary
PSDisplay.quiet – Suppress driver init chatter when True.
maximized – Open maximised, the panel exactly the window’s client area at scale 1 (width, height and scale are then ignored). WinDisplay only, for now; the other backends open at width x height.
**kwargs – Passed on to the backend that wins, so a registered backend can take its own options (
tv=...). A backend that isn’t built in also getsrotationas a keyword when it isn’t 0.scale,title,quietandmaximizedare window hints for the built-in backends and never reach one that isn’t.
- Raises:
TypeError – A backend was given a keyword it doesn’t take, such as a
rotationit has no parameter for. The message names the backend.
The search order is the
OMNIPYTHON_DISPLAYenvironment variable, then the backends a board config asked for withrequire, then the ones in the box. Seebackends.- Returns:
A
PSDisplay,JNDisplay,WinDisplay,PGDisplay, orSDLDisplaywithget_eventsset for board_config wiring; or whatever registered backend was asked for.