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.host_kind()[source]

Return "wasm", "android", "pyscript", "jupyter", or "desktop".

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 gets rotation as a keyword when it isn’t 0. scale, title, quiet and maximized are 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 rotation it has no parameter for. The message names the backend.

The search order is the OMNIPYTHON_DISPLAY environment variable, then the backends a board config asked for with require, then the ones in the box. See backends.

Returns:

A PSDisplay, JNDisplay, WinDisplay, PGDisplay, or SDLDisplay with get_events set for board_config wiring; or whatever registered backend was asked for.