Examples
The repository includes example scripts in examples/widgets/, examples/multimodal/, and examples/showcase/ that cover the current builder set, focus routing, and the higher-level sequential demos. v0.4 examples are aligned with automatic input handling and snapshot-first inspection APIs. Additional widget demos include button_and_badge_demo.py, menu_and_tags_demo.py, scroll_container_demo.py, and text_and_box_demo.py.
Progressbar Animation
examples/widgets/progressbar_dual.py — Two progress bars animating at different speeds with custom styling.
python examples/widgets/progressbar_dual.py- Bar A fills at full speed (0 → 100% in 100 frames)
- Bar B fills at half speed (0 → 50%)
- Custom characters ('#'/'-') and RGB colors per bar
- ESC to quit early
Choice Menu
examples/widgets/choice_palette.py — Color palette selector with keyboard navigation.
python examples/widgets/choice_palette.py- Palette choices are rendered as keyboard-selectable menu entries
- Arrow keys to navigate, Enter to confirm
- Prints the selected color name and RGB to stdout
- ESC to cancel
Canvas Drawing
examples/widgets/canvas_bounce.py — Animated bouncing ball with real-time graphics.
python examples/widgets/canvas_bounce.py- Full-screen canvas with bordered frame
- Bouncing ball with HSL color cycling
- Real-time FPS counter displayed in the top-right corner
- Ball bounces within the inner area with velocity reversal on boundaries
- Runs until any key is pressed
Multi-Widget Layout
examples/multimodal/focus_routing.py — Keyboard and mouse focus routing across interactive widgets.
python examples/multimodal/focus_routing.py- Demonstrates how scene focus changes when interacting with multiple widgets
- Uses keyboard and mouse input together instead of treating them separately
- Exercises focus handoff between choice and text input widgets
- Highlights how hitmap-based picking keeps click handling deterministic
- ESC to force quit
Full Widget Showcase
examples/showcase/sequential_journey.py — Sequential demo that walks through the core widget types and interaction flow.
python examples/showcase/sequential_journey.py- Progressbar, choice, input, and canvas are exercised in order
- Shows the standard register -> create -> configure -> render flow
- Good smoke test for the native builder pipeline
- Useful as a quick validation that the compiled core is wired correctly
Other showcase demos in the repository include buffer_hierarchy_demo.py and scene_stats_demo.py for buffer layering and scene instrumentation.