Back to Projects
TUIX v0.1Alpha

Last Updated: 2026-05-20

Getting Started with TUIX Core

This guide walks you through the prerequisites, import, and basic workflow for building terminal user interfaces with TUIX Core.

Prerequisites

Before starting, ensure you have Python 3.8+ installed. TUIX Core depends on wcwidth for accurate Unicode character width measurement. Your terminal must support ANSI escape sequences and 24-bit RGB colors (most modern terminals do).

Windows UsersOn Windows, TUIX Core automatically calls kernel32.SetConsoleMode to enable virtual terminal processing. This allows ANSI escape codes (colors, cursor movement) to work in cmd.exe and PowerShell.

Import

from tuix.core import TuixEngine

engine = TuixEngine()

Creating a TuixEngine instance initializes all five subsystems: engine.styles (Styles), engine.components (ComponentAPI), engine.layout (LayoutEngine), engine.render (RenderEngine), and engine.input (InputHandler).

Basic Workflow

  1. Instantiate TuixEngine — initializes all subsystems
  2. Create a component via engine.components.create(type, id)
  3. Configure properties via engine.components.set_property()
  4. Set layout dimensions and margin modes via engine.layout
  5. Optionally customize styles via engine.styles
  6. Call engine.render.draw() to render and start the input loop

Quick Example

from tuix.core import TuixEngine

engine = TuixEngine()

# 1. Create a component
engine.components.create("choice", "main_menu")

# 2. Set properties
engine.components.set_property(
    id="main_menu", param="label", value="Select an option:"
)
engine.components.set_property(
    id="main_menu", param="choices",
    value=[[{"name": "Option 1", "action": None}]]
)

# 3. Render UI
engine.render.draw()
# Input is automatically handled in draw() for choice components

What Happens on draw()

When you call engine.render.draw(), the framework:

  1. Clears the terminal screen
  2. Computes layout dimensions proportional to terminal size
  3. Renders the component with Unicode box-drawing borders and styled text
  4. Enters the input loop — arrow keys navigate the menu, Enter confirms selection

Next Steps

Head to the Installation guide to install TUIX Core, then follow the First Component tutorial to build a full interactive menu.