display
pdwidgets.display
Display framebuffer, rendering, and runtime integration.
Display(display_drv, runtime, tfa=0, bfa=0, format=RGB565)
Bases: Widget
Root display surface that owns the framebuffer, event loop, and widget tree.
Construct with a board display_drv and eventsys.Runtime. The runtime
drives input dispatch and periodic :meth:tick rendering; apps call
runtime.run_forever() after building the UI.
Initialize a Display object to manage the display and child widgets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_drv
|
DisplayDriver
|
The display driver object that manages the display hardware. |
required |
runtime
|
Runtime
|
The event runtime object that manages the event system. |
required |
tfa
|
int
|
The top fixed area of the display. |
0
|
bfa
|
int
|
The bottom fixed area of the display. |
0
|
format
|
int
|
The color format of the display (default is RGB565). |
RGB565
|
Usage
from board_config import display_drv, runtime display = Display(display_drv, runtime)
active_screen
property
writable
The currently attached :class:Screen, if any.
color_theme
property
Semantic color theme for this display.
display
property
Return self.
height
property
Framebuffer height in pixels.
parent
property
writable
Always None; the display is the root.
visible
property
writable
Always True.
width
property
Framebuffer width in pixels.
x
property
Display x offset (always 0).
y
property
Display y offset (always 0).
add_child(screen)
Set :attr:active_screen to screen.
add_task(callback, delay)
Schedule a repeating task run from :meth:tick.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
callable
|
Zero-argument callable to run. |
required |
delay
|
int
|
Interval between runs, in milliseconds. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Task |
Task
|
The created task (pass to :meth: |
clip_pop()
Pop the current clip rectangle and restore the previous draw target.
clip_push(area)
Push an integer clip rectangle for nested draw/render (MCU-safe, no alpha).
handle_event(event, condition=None, point=None)
Dispatch an event, honoring modal pointer capture and focus keys.
Focus keys (Tab / Shift-Tab / arrows) are handled by
:attr:focus_manager before the widget tree walk. Pointer modality
(see :meth:Widget.set_modal) only affects mouse/touch — key focus is
independent so sheets/dialogs can still host TextInput fields.
quit()
Remove this display from the active list (called on QUIT).
refresh(area)
Copy a dirty region from the internal framebuffer to the physical display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
Area
|
|
required |
remove_task(task)
Cancel a scheduled task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Task
|
A task previously returned by :meth: |
required |
render_dirty_widgets()
Redraw all invalidated widgets, breadth-first, without recursion.
set_position(*args, **kwargs)
Reset geometry to the full display size.
tick()
Render one widget frame.
Flushes dirty areas to the display, otherwise runs scheduled tasks and
re-renders invalidated widgets. Driven automatically by the runtime's
shared timer (see :meth:_attach_to_runtime); may also be called
manually (e.g. :func:tick) to force a frame.
tick(_=None)
Call the tick method of every registered :class:Display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_
|
Any
|
Ignored positional argument so this may also be used as a
timer/ |
None
|