Repository navigation
Displaypad
Leas Porscha edited this page Aug 30, 2026
·
5 revisions
displaypad_lib.DisplayPad — the main class for controlling the pad.
DisplayPad(rotation=0, debounce_sec=0.01, dc_window=0.6, auto_connect=True)| Argument | Type | Default | Description |
|---|---|---|---|
rotation |
int |
0 |
Clockwise display rotation in degrees (0, 90, 180, 270) |
debounce_sec |
float |
0.01 |
Minimum seconds between repeated press events |
dc_window |
float |
0.6 |
Double-click detection window in seconds |
auto_connect |
bool |
True |
Open hardware on init. Pass False to connect later |
| Method | Returns | Description |
|---|---|---|
is_connected() |
bool |
True if hardware is connected |
try_connect() |
bool |
Connect and push current buffer. Returns False on failure, never raises |
update(timeout=20) |
— | One loop iteration: poll input, fire events, repaint dirty keys |
set_brightness(percent) |
— | Set backlight 0–100%. No-op if disconnected |
push_image(image_or_path=None) |
— | Upload current buffer (or given image) to all 12 keys |
add_page(page_id, page) |
— | Register a Page. Repaints immediately if it replaces the active page |
switch_to_page(page_id) |
bool |
Switch active page and repaint |
blank() |
— | Backlight off, all tiles black |
clear() |
— | Remove all keys from active page, clear display to black |
disable() |
— | Blank display, stop background worker, close driver |
screenshot(filename) |
— | Save current buffer to file |
pad[0] = MyKey() # assign key to slot 0 on the active page
pad[0] # get the key at slot 0
del pad.keys[0] # or set to None to clear a slotSlots are 0–11, left-to-right, top row then bottom row.
try:
while True:
pad.update(20) # 20 ms poll timeout
except KeyboardInterrupt:
pass
finally:
pad.disable()update() calls on_tick() on every active key, fires input lifecycle hooks, and uploads changed tiles. When 3 or more keys change in one cycle, the full panel is uploaded instead of individual tiles.
See the Home page for a complete hotplug example.