- Category
- Developer Tools
- Rank
- No. 4707Tools index
- Pricing
- Open Source
- Type
- TOOL
- Date
About
A Tk implementation written in Zig on top of the ztcl interpreter, so existing Tcl and Tk scripts run on desktop, phones and the web. It draws with each platform's graphics API and styles widgets with CSS, and on iOS and Android it can build screens from native views. Agents can see the window, read widgets and click without a display, and apps from a URL run in a sandbox with no file, network or process access.
At a glance
ztk is a from-scratch reimplementation of Tk, written in Zig, that runs Tcl/Tk scripts on its own interpreter (ztcl) with no Tk or Xlib code underneath and no library to install. One script targets Linux, macOS, Windows, the web, iOS and Android, and each platform draws through its own graphics API, with a CPU renderer that tests compare the GPU output against. Styling moves to a subset of CSS, and a flex geometry manager is added alongside pack and grid. A second focus is automation: snapshot, widget-tree and input-injection commands make a UI check an ordinary Tcl script in CI. It is at 1.0.0-beta.8 under BSD-2-Clause, labeled experimental, and its code, tests and docs are written by AI agents under human direction.
Good fit
Someone who already writes Tcl/Tk and wants the same script to ship as a GPU-rendered desktop app, a phone app and a web page. ztk bundle emits one program file per desktop target plus a macOS app folder, an iOS app and an Android APK, cross-built from any computer. It also suits teams that want a GUI an agent can drive and verify: ztk::snapshot writes a PNG, ztk::tree lists every widget with its class and box, ztk::inject sends clicks and keys through the real hit test and focus, and ztk::debug mark/diff compare a window before and after a change against a golden image. On phones the Tk pointer bindings map onto touch, with per-finger and pinch virtual events, insets for notches and the keyboard, and tk appdata for saved state. Styling is a CSS subset with light and dark schemes, and ttk::style configure settings become CSS rules, so an existing theme script keeps working while the look modernizes.
Consider something else when
Skip it if you need a drop-in Tk for an app already in production. canvas postscript errors out, text peers error out, Tk cannot load into a child interpreter, selection works only inside the app, tk busy marks a window without blocking its input, and tk fontchooser shows a dialog on Windows only. Accessibility and internationalization are the sharpest exclusions: the Tk 9 screen reader support and right-to-left text are not in ztk yet, and on phones the composition of an input method for Chinese, Japanese and Korean, swipe-typed words and keyboard corrections never reach the widget. So CJK text entry and screen reader users are out of scope today. Also skip if you are coming from Python: libztk, the drop-in libtk8.6 that would run tkinter apps, is listed as in progress. Phone apps that need location, sensors or other native device APIs have no path yet either.
Start here
Install with brew install beetlebugorg/tap/ztk on macOS or Linux, or open the playground in a browser to try it with nothing installed. Then follow the quick start: save the counter example as counter.tcl, save its three CSS rules as counter.css in the same folder, and run ztk counter.tcl in a Wayland session. It is plain Tk, so ttk::button, pack, -textvariable and bind behave as in wish, while the stylesheet restyles the button and label. If you have no display, ztk --headless --scale 2 --exit-after-frames 1 --screenshot counter.png counter.tcl draws the same window to a PNG with the CPU renderer, which is also the quickest way to see whether the agent and CI workflow fits how you test.
Cost and requirements
Free and BSD-2-Clause. Homebrew covers macOS and Linux on arm64 and x86-64; Windows installs from a release zip; the web build is the npm package @beetlebug/ztk. Release binaries ship the GUI backend of their platform plus the headless one. Building from source needs Zig 0.17.0, and on Linux also glslc. Platform floors are macOS 13 or later, Windows 10 and 11, and Android 10 or later. Cross-bundling needs the target's ztk program: ztk runtime install fetches it from the matching release and checks its signature and hash, or zig build runtimes builds it locally. A script run by the ztk program gets the files and clock of the user as wish does, and anything further, including sockets, exec and threads, needs --allow. An app loaded from a URL runs with no capability at all and a memory cap, so no file, network, process or system clipboard access.
Limits to know
Not installed or run here, so everything below comes from the project's own pages. The project calls itself experimental and not yet a drop-in Tk, and asks you to review the code before depending on it because agents wrote it. The native look of each platform is still open. Published frame times come from one machine, an Intel Core i7-6700K running zig build bench in ReleaseFast with other load present over a three-day window, so they say little about phones or weaker GPUs. Backends vary in maturity: the direct framebuffer backend for Linux devices is marked not tried on a device and needs an explicit unsafe-test flag, and the X11 backend is CPU-rendered with no popups and no input method. On the web only the main window gets a canvas, so a second toplevel has none. The docs also conflict on the Android soft keyboard, with the touch page describing it opening on focus and the platform table listing it as not yet present, so verify that before committing to a phone form.
Related work
- Claude Code (complement)
Still unclear
- Do the frame-time results hold on phone GPUs and older hardware, or only on the desktop class that was benchmarked?
- Is the script-facing API frozen before 1.0, or can beta releases still change widget behavior that an app depends on?
- How large and how quick to start is a bundled iOS or Android app, given that only desktop binary sizes are published?
- Which parts of libztk work today for existing Python tkinter apps, and on what timeline?
Sources checked 2026-12-03. Source-based assessment.
Similar tools
Tags
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.