Tanmatsu¶
- class tanmatsu.Tanmatsu(title: str | None = None)¶
- Parameters
title (str) – The title the terminal window should be set to.
This class fulfils two functions:
Configures the terminal emulator (setting proper modes and so on).
Handles the main TUI loop (draw, take input, process input).
As a bare minimum, a program written with tanmatsu must perform the following three steps:
Instantiate Tanmatsu() as a context manager.
Set the root widget with
set_root_widget().Start the main TUI loop with
loop().
For example:
from tanmatsu import Tanmatsu from tanmatsu.widgets import TextBox with Tanmatsu() as t: t.set_root_widget(TextBox(text="Hello! こんにちは!")) t.loop()
- set_root_widget(widget: Widget)¶
Set the root widget. A root widget must be set before
loop()is called.- Parameters
widget (Widget) – The widget to set as the root widget.
- loop()¶
Enter the main TUI loop—drawing to the screen, processing input, and redrawing.