Back to Projects
TUIX v0.6Beta

Last Updated: 2026-08-14

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 content_builder.register_standard() after core.init() to register all built-in builders under the `tuix` namespace. Builder constants are bytes matching the native builder names, for example content_builder.TEXT or content_builder.GRID.

Creating A Widget

uid = objects.create_object(
    content_builder.BUTTON,
    b'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 with grapheme awareness.
Interactive controlsBUTTON, CLICKABLE_TEXT, CHOICE, INPUT, CHECKBOX, MENUKeyboard and mouse aware widgets with query/take state APIs.
DrawingCANVASManual pixel, line, rect, circle, text, and sprite drawing APIs.
Viewport widgetsSCROLL_CONTAINER, LIST_VIEW, TEXT_AREAWidgets that own scroll offsets, content size, and clipping behavior.
Layout parentsROW, COLUMN, SPLIT_PANE, GRIDNative containers that place child buffers.
Modal UIDIALOGDialog body, backdrop, focus trapping, and close request state.

Input Handling

Built-in interactive widgets process keyboard and pointer input during the native frame loop. Application logic queries and consumes widget event states using one-shot getters (such as `tuix_button_take_pressed()`, `tuix_checkbox_take_changed()`, `tuix_choice_is_confirmed()`, `tuix_input_is_submitted()`, or `tuix_listview_take_activated()`).

Snapshots

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