Modern Tk for every screen. Write one script. Get a fast, smooth app for desktop, phone, and the web.
Docs and live demos: https://beetlebug.org/ztk/
One script, three screens: the game Lamplighter, docs/toys/native/lamplighter.tcl, on a desktop, iOS, and Android.
Note
AI agents write the code, the tests, and the docs of this project, on purpose. A person sets the direction. Why
- A desktop app. Windows, macOS, and Linux apps from one script, shipped as a single file.
- A phone app. Real native screens on iPhone and Android, in the same Tcl you write for the desktop.
- A kiosk screen. Full-screen, touch-first apps for status boards, check-in desks, and machine panels.
- A game or a tool. Canvas, animation, keys, and the mouse. Three games walk you through it.
You write the same Tcl and Tk commands as always. ztk runs them on a fresh interpreter written in Zig, draws them with each platform's graphics hardware, and lets CSS handle the look. One script covers the desktop, phones, and the web.
A spreadsheet with 10,000 rows and formulas: examples/spreadsheet.tcl.
A vector drawing tool and a status board: examples/vector.tcl and examples/dashboard.tcl.
- One script, every screen. The same Tk script runs on Linux, macOS, Windows, the web, iOS, and Android.
- Native controls on phones. On iOS and Android, a script builds its screens from the views of the system: navigation stacks, lists, tabs, pickers, and alerts. The Tk widgets work there too.
- A modern look. A CSS stylesheet styles each widget, in light and dark.
- Fast. In
zig build bench, a frame with 1,000 widgets uses 0.85 ms of CPU time at the 99th percentile. - Other languages. An app in Rust, Go, or JavaScript compiles to WebAssembly and opens a ztk window.
- Made for agents. An agent can see the window, read each widget, and click in it, with no display.
- Safe to run. An app from a URL runs in a sandbox with no file, network, or process access.
- One command to ship.
ztk bundlewrites the app for each desktop and phone platform. - No library to install. ztk uses the platform, the ztcl interpreter, and the Zig standard library. The decoders of JPEG and WebP are compiled in.
| Platform | Install |
|---|---|
| macOS | brew install beetlebugorg/tap/ztk, or the .tar.gz of a release |
| Linux | brew install beetlebugorg/tap/ztk, or the static .tar.gz of a release |
| Windows | The .zip of a release |
| iOS and Android | ztk bundle writes the app from your script: Touch and the screen |
| Web | npm install @beetlebug/ztk |
Install has the build from source.
ttk::label .title -text "Hello from ztk"
ttk::entry .name -textvariable name
ttk::button .greet -text "Greet" -style Accent.TButton -command {set msg "Hello, $name!"}
ttk::label .msg -textvariable msg
pack .title .name .greet .msg -padx 12 -pady 4 -anchor w
ttk::style configure Accent.TButton -foreground white -background #2563ebztk hello.tcl- The ztk program: each flag of the command line, and
ztk bundle - Security model: what a script and an app from a URL can reach, and how to report a vulnerability
- Quick start and the widgets
- Styling and themes and animation
- Apps in Rust, Go, or JavaScript: a program that compiles to WebAssembly makes a native ztk window. The demos have a spreadsheet and a vector app in each language.
- On the web, On Linux, On macOS, On Windows, and embed in Zig
- Touch and the screen, On iOS, and On Android
- For agents: the tools that see, read, and drive a window
- Tk apps on ztk and the games
- The ztk:: commands and debugging: visual diffs, traces, slow frames, and the MCP tools
- Performance and differences from Tk
- For contributors: docs/dev/ has the plan, the task lists, and the reports.
This project is 100% AI-driven, on purpose. AI agents write the code, the tests, and the docs. A person sets the direction.
It is an experiment in how far a project can go when you let go of how software "should" be developed and move as fast as the agents permit. An optimization that was too much work before is a 15-minute change now, so we try each one.
The world changed. Tk looks like a toolkit for people to learn. ztk is for AI. It is for agents.
ztk is experimental, and it is not yet a drop-in Tk. Differences from Tk lists what is missing, such as text peers and the selections of the system. AI coding agents wrote the code and the docs, under human direction. Review the code before you depend on it. The plan has the roadmap, and the issues take bug reports and requests.
A contribution starts in a Discussion: a bug with the smallest script that shows it, or an idea with the use that you have for it. A maintainer makes an issue from the Discussion, and an AI agent of the project does the work of the issue. Do not open an issue or a pull request yourself. CONTRIBUTING.md has the steps, and DISCUSSIONS.md has what a discussion of a bug, an idea, or a question must give.
Write to [email protected] about ztk. Start a Discussion for a bug or a request, and report a security problem as SECURITY.md says.
BSD-2-Clause. See LICENSE. ztk has no code of Tk. References credits Tk and the other sources.