Interactive rendering library for ESP32/MicroPython environments. Provides HTML UI components with trigger logic and modular page construction.
Render text on the canvas at a specified position.
Create a clickable button. Optionally includes an image.
Render a text input field. Retrieve content with get_input(id).
Add file upload input. Automatically triggers upload to server using POST.
- Accepts MIME filters (e.g.
"image/*"or".json") - Uploaded file is saved to specified
save_todirectory
Bind a button to a Python function or lambda. Executes callback when triggered.
Generate HTML from current canvas state.
- If
refresh=True, forces automatic page reload (once) using URL hash control - Ensures consistent page updates during transitions
canvas = HtmlCanvas(800, 600)
canvas.draw_text("Enter your name:", x=50, y=40)
canvas.input_box("username", x=50, y=80, placeholder="Type here")
canvas.button("Submit", x=300, y=80, trigger_name="submit")
canvas.on_trigger("submit", lambda: next_page().render("Next", refresh=True))
html = canvas.render("Welcome Page", refresh=False)