TUIX v0.6Beta
Getting Started with TUIX Core
This guide shows the standard v0.6 flow: initialize core, register builders via content_builder, create/select a scene, start input for interactive apps, create widgets, run frames, and clean up.
Recommended Reading Order
- Install TUIX Core and verify imports.
- Build the first widget example.
- Read Widgets, Layout API, and Input Handling before composing larger screens.
Prerequisites
- Python 3.10 or newer.
- A terminal with ANSI escape support.
- Cython 0.29 or newer and a C compiler only when building from source.
Import Pattern
from tuix.core import core, scene, buffer, content_builder, input
from tuix.core import object as objectsStandard Workflow
- Call core.init().
- Call content_builder.register_standard() before creating objects.
- Create a scene with scene.init_scene(b"Main") and select it with scene.select_scene(b"Main").
- Start input.listen() for interactive widgets.
- Create objects with objects.create_object(...).
- Run core.main_loop() once per frame in your application loop.
- Stop input and shut the engine down during cleanup.
Minimal Example
from tuix.core import core, scene, content_builder, input
from tuix.core import object as objects
core.init()
content_builder.register_standard()
scene.init_scene(b'Main')
scene.select_scene(b'Main')
input.listen()
uid = objects.create_object(content_builder.TEXT, b'Main', 0.5, 0.1, 0.05, 0.05)
obj = objects.get_object_by_uid(uid)
objects.tuix_text_set_text(obj, 'Hello from TUIX 0.6')
objects.tuix_text_set_fg(obj, 120, 220, 160)
for _ in range(5):
core.main_loop()
input.stop()
core.shutdown()What Happens Each Frame
- Input is read from native queues and routed to focused, captured, modal, or hitmap-picked widgets.
- Geometry is resolved from proportional modifiers, parent layout results, layout slots, and grid placements.
- Builders update state and provide pixels, governed by TuixPixelReturnPolicy (persistent or core-owned temporary buffers).
- The compositor clips viewports, builds a hitmap, composites buffers with paint-mask awareness, and the renderer writes terminal-visible differences.