Tesserae¶
Write desktop apps in Python and TDL. A Tesserae app is TDL views (what the screen looks
like), each paired with a Python ViewModel (what it does), drawn by the
Tesserae Render Engine (tess_re): rendering, layout, animation
and accessibility in Rust underneath, which you never have to touch.
---
TDL: 0.2
Name: Counter
Tesserae: "0.6"
---
# Counter_View.tdl
Container {
Name: Counter
Style { Flex_Direction: vertical, Gap: 12, Padding: 24, Background: surface }
Children {
Text {
Name: label
Text: Count: <| count |>
Typography_Role: headline_medium
Style { Foreground: on_surface }
}
Button {
Name: button
Label: Count
Style { Width: 120 }
Handlers { On_Click: increment }
}
}
}
# Counter_ViewModel.py
from tess_ui import Signal, ViewModel
class CounterViewModel(ViewModel):
views = "Counter" # the view it serves
def __init__(self):
super().__init__()
self.count = Signal(0)
def increment(self):
self.count.update(lambda n: n + 1)
# app.py
from tess_ui import App
from Counter_ViewModel import CounterViewModel
app = App(width=240, height=160, title="Counter", search=["."])
app.bind(CounterViewModel)
app.open_view("Counter") # Counter_View.tdl
app.show("Counter")
app.run()
Tesserae is on PyPI as tesserae-ui, pre-alpha, and runs on
Linux, macOS and Windows.
What you get¶
- Views and ViewModels. A view is TDL: a tree of nodes, each a block headed by its widget. A ViewModel is Python, and serves the
views that name it. A view with
Paramsis a component, called by its name;ForandIfbuild lists and choices from data. See The View Language, Apps & Screens and Components & Embedding. - Reactive state.
Signal,Computed,EffectandViewModel: bindings keep the screen in step with them. See Reactivity. - Material Design 3. Every MD3 component with its TDL, a stylesheet for each, and themes: a seed colour makes the palette, and light and dark follow the OS. High contrast and reduced motion follow it too.
- Real desktop behaviour. Keyboard, state layers and screen-reader support, overlays, a window, docks, routed screens and several windows, and custom title bars. A layout can follow the window's size class.
- Fast iteration. Hot reload shows an edited view, or a theme, in a running app with its state kept, and editor support completes and checks your TDL.
- Shipping.
tesserae buildmakes one executable, or an installer: Releasing.
Where to go¶
| Installation | pip install tesserae-ui |
| Getting Started | Your first window and node, declaratively and from Python |
| Tutorial and the same as a project | A Tasks app in six steps: components, styling, screens, a custom window; in one flat folder, then as a tesserae new project |
| Guide | How each part works |
| Components and Stylesheets | Every MD3 component, its TDL and its look |
| Themes | Colour, shape, type, light and dark |
| Python API and TDL reference | Every class, function and key |
| Architecture | How it fits together |
| Changelog and Migrating | What changed, release by release |
Files: Tesserae reads them, tess_re gets data¶
You always give Tesserae file paths or names: views, images, themes, stylesheets and fonts. Tesserae reads, parses and
decodes them itself and hands tess_re only data. Every error names the file, line and column you wrote, and the nearest
name when you misspelt one.