Back to Projects
TUIX v0.5Beta

Last Updated: 2026-05-20

Widgets

Widgets are native builders plus per-object state. Python creates objects and calls typed setter/getter APIs; the C builder owns per-frame event handling, layout, resize, and pixel generation.

Builder System

Call builders.register_standard() after engine.init() to register all built-in builders. Builder constants are bytes matching the native builder names, for example builders.TEXT or builders.GRID.

Creating A Widget

uid = objects.create_object(
    builders.BUTTON,
    'Main',
    0.25, 0.08,  # width_mod, height_mod
    0.1, 0.1     # margin_top_mod, margin_left_mod
)
button = objects.get_object_by_uid(uid)
objects.tuix_button_set_label(button, 'Run')

Proportional Geometry

For normal objects, width_mod, height_mod, margin_top_mod, and margin_left_mod are fractions of the terminal. For layout children, parent builders can override final rectangles through layout slots, grid placement, and layout rect APIs.

Widget Categories

CategoryBuildersNotes
Basic displayTEXT, BOX, DIVIDER, BADGE, TAG, STATUSLabels, frames, dividers, and simple styled text.
Interactive controlsBUTTON, CHOICE, INPUT, CHECKBOX, MENUKeyboard and mouse aware widgets with query/take state APIs.
DrawingCANVASManual pixel and primitive drawing APIs.
Viewport widgetsSCROLL_CONTAINER, LISTVIEW, TEXTAREAWidgets that own scroll offsets, content size, and clipping behavior.
Layout parentsROW, COLUMN, SPLITPANE, GRIDNative containers that place child buffers.
Modal UIDIALOGDialog body, backdrop, focus trapping, and close request state.

Input Handling

Built-in interactive widgets are handled by the frame loop. Compatibility feed_input functions still exist for older code, but normal v0.5 usage starts input.listen(), sets focus where needed, and calls engine.main_loop().

Snapshots

Use buffers.get_buffer_snapshot(...), buffers.get_buffer_snapshot_by_uid(...), and objects.get_object_snapshot_by_uid(...) for read-only inspection. Avoid relying on raw native pointers for diagnostics.