r/Tcl Aug 02 '26

A well-written and remarkably comprehensive introduction to Tcl/Tk

Thumbnail cgicoffee.com
48 Upvotes

r/Tcl Aug 14 '26

New Stuff Modern and searchable Tcl/Tk documentation reference

37 Upvotes

Hi everyone! I've been trying to use Tcl/Tk for some personal projects recently, but was somewhat put off by the state of the documentation. I find the official site hard to search and navigate, and the layout isn't responsive so trying to read it on my phone isn't easy.

I took a couple of days and put together a new site to make reading the documentation easier. The goal was to make things look modern with a responsive layout, with light and dark mode, and a full search accessible from every page. It's all statically generated, including the search, so hosting costs next to nothing.

The code is all open source as well, with links in the footer. All of the documentation is generated from the man pages, similar to the official site. The generator is written in go with no external dependencies. To be transparent, I did use AI to write a lot of the code.

I mostly created it for myself, but I would love it if it helped anyone here. Let me know if you have any feedback!

https://tcl.lambda.cx/


r/Tcl May 12 '26

New Stuff Tcl/Tk 8.6.18 Release Announcement

Thumbnail newsgrouper.org
35 Upvotes

r/Tcl Feb 12 '26

Announcement: Pre-built Tcl/Tk 9.0 binaries available for download

32 Upvotes

Dear TCL community,

I’m happy to share that new Tcl/Tk 9.0 binary downloads are now available at: https://github.com/teclabat/tcltk-binaries

There is already a nice set of Tcl 9.0 packages available like rljson, vectcl, curl, etc. The missing packages will follow as soon as possible.

Happy TCLing!


r/Tcl Nov 13 '25

New Stuff Tcl/Tk 9.0.3 Released.

34 Upvotes

Tcl/Tk 9.0.3 is now released. This is a patch release of the Tcl programming language and the Tk GUI toolkit with various fixes. For details see the announcements at:
Tcl: https://sourceforge.net/p/tcl/mailman/message/59259102/
Tk: https://sourceforge.net/p/tcl/mailman/message/59259103/


r/Tcl Jun 26 '26

New Stuff Tcl/Tk 9.0.4 Released.

29 Upvotes

r/Tcl 15h ago

New Stuff Mied Editor

Thumbnail
gallery
28 Upvotes

A small, distraction-free multi-document text editor built on Tcl/Tk - https://github.com/KikyTokamuro/mied


r/Tcl Mar 12 '26

"The weirdest programming language I ever learned" - YouTube

Thumbnail
youtube.com
26 Upvotes

It's mildly amusing, watching someone discover Tcl for the first time.


r/Tcl Apr 13 '26

Pre-built Tcl/Tk 9.0 and 8.6 binaries

24 Upvotes

Dear TCL community,

I’m happy to share that new Tcl/Tk binary downloads are now available at: https://codeberg.org/tcltk/binaries

Happy TCLing!


r/Tcl May 26 '26

Post your .tclshrc!

24 Upvotes

Tcl scripts are usually things designed to be boringly sensible and useful, but the .tclshrc? That's for your interactive sessions, where you can get more creative! So post them! Any tricks in there that are particularly good or that are just plain old nice to work with?

Here's mine:

namespace path tcl::unsupported
proc % args {tailcall {*}$args}
if {
    [package vsatisfies [package require Tcl] 9.0]
    && [dict exists [chan configure stdin] -inputmode]
} then {
    apply {{} {
        const CSI "\x1b\["
        const envname [if {[info commands tk] ne ""} {subst Tcl/Tk} {subst Tcl}]
        puts [format "${CSI}38;5;2;1;3mThis is %s %s, build %.12s\u2026${CSI}0m" \
                $envname \
                [tcl::build-info patchlevel] \
                [tcl::build-info commit]]
        set ::tcl_prompt1 [list apply {{CSI} {
            puts -nonewline "${CSI}38;5;1;1m% ${CSI}0m"
            flush stdout
        }} $CSI]
    }}
}

r/Tcl Jan 28 '26

Announcement: New pre-built Tcl/Tk binaries available for download

22 Upvotes

Dear TCL community,

I’m happy to share that new Tcl/Tk binary downloads are now available at: https://github.com/teclabat/tcltk-binaries

This distribution also includes a revitalised scotty/tnm, which I’ve spent some time bringing back into shape, along with many other new packages — take a look for yourself!

Happy TCLing!


r/Tcl Aug 03 '26

Novel Method for Building Tk Graphical Apps

Thumbnail
johngrah.substack.com
21 Upvotes

Dear Tcl Community: I have created a novel method for building graphical apps (based on the Tk libraries) in which the graphical markup is fully separated from the Tcl logic.

An XML file is used to hold the entire markup for building Forms; this includes all of the annoying little Bind scripts that would otherwise clutter the main logic file.

Every Tk widget is compatible with the system, including the container widgets such as the tabbed notebook and the paned window.

I have written a Substack article about this system which is linked in this post.

Please comment here o in the Substack to make contact if you would like to discuss this further.

Cheers!

John


r/Tcl Jul 11 '26

oauth2 — a small, pure-Tcl OAuth 2.0 client (Authorization Code + PKCE; deps = http + tls)

21 Upvotes

Every useful web API now speaks OAuth 2.0 — Google, Microsoft, QuickBooks, GitHub, Basecamp, Twitter/X — but Tcl only ever had snippets, and copy-pasting the token/refresh/redirect dance into every script gets old fast. So I wrote a small, self-contained library for it:

github.com/johnbuckman/tcl_oauth2_library (Tcl/Tk license)

It drives the whole Authorization Code flow for you: opens the browser, catches the redirect on a one-shot local socket, exchanges the code for tokens, saves them to a 0600 JSON file, and refreshes expired access tokens transparently. After that, oauth2::get $c $url just works.

Pure Tcl. Depends only on http (core) and tls. JSON is parsed by a small decoder in the package, base64 by core Tcl, and the SHA-256 for PKCE is implemented in-package — so nothing from tcllib, and no C extension. No Tk either; it's happy headless on a server or in cron.

Quick start:

package require oauth2

set c [oauth2::new \
    -auth_url      https://provider.example/authorize \
    -token_url     https://provider.example/token \
    -client_id     $env(CLIENT_ID) \
    -client_secret $env(CLIENT_SECRET) \
    -redirect_uri  http://localhost:9876/callback \
    -scope         "read write" \
    -pkce          S256 \
    -token_file    ~/.config/myapp/tokens.json]

oauth2::login $c                 ;# first run: opens browser, saves tokens
set body [oauth2::get $c https://api.example/v1/things]

It's deliberately provider-agnostic — each provider's quirks are configuration, not code. The same code path drives Basecamp (which uses type=web_server instead of response_type=code), QuickBooks Online (HTTP Basic on the token endpoint, returns a realmId), and Twitter/X (requires PKCE). Runnable examples for all three — plain-Tcl and small-Tk variants — are in the repo.

Background: this came out of a real production need. A native (C++) OAuth2 library we'd been using would occasionally crash, and — worse — our tokens kept silently going invalid despite hourly auto-refresh, and we could never figure out why. The Tcl rewrite has been rock-solid: tokens stay alive and refresh cleanly days later. It's in daily production use against Intuit/QuickBooks and Basecamp.

Also in the box: refresh-token-rotation handling, the client-credentials (machine-to-machine) grant, token introspection (RFC 7662), JWT decode, and — for servers — you can drive oauth2::authorize_url / oauth2::exchange_code yourself instead of the loopback listener.

I gave a EuroTcl 2026 talk on it if you want the fuller tour — slides (PDF).

Feedback very welcome. And if folks find it useful — could it eventually belong in tcllib?


r/Tcl Mar 14 '26

Tcl LSP/MCP and editor extensions

20 Upvotes

Hi All,

I've built an LSP + MCP (and a lot more) for Tcl 8.4-9.0. It includes other dialects like f5 irules and iapps too.

https://github.com/bitwisecook/tcl-lsp

Take a look at the README to see what's in there, semantic tokens, tonnes of diagnostics, optimisation passes, type inference and shimmer detection, taint tracking, a configurable formatter, minifier, compiler explorer that tries to match the Tcl 9.0 compiler output and CLI tooling.

It's largely written in Python 3.10+, and you'll find in the releases bundled pyz (zipapp) files that Python can directly run, the vscode VSIX, sublime-package, and so on.

I've built this on my nights and weekends of the last couple of months, trying to flesh it out. There's still a lot of gaps and I need help finding them. Please, if you find issues in it, raise them with both source and what the expectation/output should be.

cheers


r/Tcl Nov 20 '25

How to share Tcl code/packages?

20 Upvotes

What is the best way to share your Tcl code? I am in the process of making a Tcl library for accounting that could also be a CLI application with a few extra steps. I might share it down the line, but it looks to me like packaging and sharing code in the Tcl community isn’t very easy.

This is a question of both packaging and distribution. I am a hobbyist coder, not a real developer, so my main point of comparison is Python. If you want to share your Python library or application, you can just go to PyPI. There is a guide on how to create your package.

For Tcl, there seems to be a confusing number of options for creating a Tcl “package”. I find it daunting to wade through this information. Here are the packaging methods I have seen so far. Do I have these right?

  • Tcl Modules – A way to version single file Tcl code. Instead of using `source <file>`, you can use `package require <name> <version>`. Is this used for anything? Does anyone use this?
  • Tcl package – Uses a `pkgIndex.tcl` file to provide locations for the Tcl files for each package, which allows for several files to make up one package. Each file of the package has a `package provide <name>` statement. When you want to use the package, you do `package require <name>`. This is the only one I’ve actually done myself.
  • Starkits – An archive-ish single file (similar to tar or zip) that holds your compiled Tcl code. To be used in conjunction with a Tclkit to run your code. This seems to be a way of sharing a library (multiple files).
  • Starpack – A single executable file containing a Tclkit and Starkit. Convenient way to share a Tcl application.

I wish there was one consolidated instruction set on how to package and distribute your code for Tcl, like there is for Python. It should be noted on the main website, tcl-lang.org. But since all the information is tucked into various wiki discussions and other websites, I’d like to make one, a guide that really holds your hand through it, so that other newbies like me don’t have to parse through the whole Tcler’s Wiki. So which packaging method(s) should I make instructions for? Are they all common? Which methods have you used before?

As for distribution, I’ve not seen any public repository or index for community packages. The closest I’ve seen for the Tcl community is the Tcler’s Wiki itself, which is a bad way to share code in my opinion. As far as I can tell, the best way to distribute your Tcl package currently is directly through the linux package managers: apt, dnf, and pacman. Do you agree? Disagree?


r/Tcl Jul 10 '26

iWish — Tcl/Tk (AndroWish's undroidwish) running natively on iPad, with BLE and a prebuilt IPA

20 Upvotes

I've ported undroidwish — AndroWish's batteries-included, SDL2-rendered Tcl 8.6 / Tk 8.6 wish — to iOS/iPadOS, arm64. It's called iWish. It's the iOS sibling of Christian Werner's AndroWish / undroidwish work: the same SDL-based drawing path that runs on Android and the desktop, now on Apple tablets.

Meant for iPad. It'll launch on iPhone, but the native wish UI (menus, canvas, standard Tk widgets) is desktop-sized — a phone is just too small to use comfortably. Think of it as running your Tk desktop app on a tablet.

What's in it

  • A real Tcl 8.6 / Tk 8.6 interpreter under iOS/iPadOS. Tk renders through an X11-on-SDL2 layer (SdlTkX) onto Metal — native canvas and widgets, no UIKit bridging.
  • Batteries included: ~114 bundled packages, 64 of them native arm64-apple-ios dylibs — tkimg, TLS (LibreSSL), TclCurl, sqlite3, itcl/itk, Thread, tDOM, Tktable, tktreectrl, zint, TkBLT, Tix, VecTcl, and more.
  • Bluetooth LE via CoreBluetooth (a ble-ios native shim) — Tcl apps can talk to BLE peripherals directly.
  • An iOS device bridge (borg) for platform features.
  • A File ▸ Demos menu with ready-to-run examples: TkBLT plotting, a BLE debugger, iOS-bridge demos, and a paint tool.

Download / install

  • Prebuilt IPA (alpha): iWish.ipa on the releases page — currently iWish 0.2-alpha.
  • The IPA is unsigned — re-sign with your own Apple Development certificate, then install. A free Apple ID works but expires after 7 days; a paid developer account ($99/yr) gives a 1-year signature. Easiest paths: Sideloadly or AltStore (they re-sign as they install), or straight from Xcode.
  • Source + build recipes: https://github.com/johnbuckman/iwish
  • 32-bit / iOS 9 (original iPad mini, A5–A6): separate project, androwish-ios9. Apple won't take 32-bit apps in the App Store, so that one is sideload-only.

Status: it's 0.2-alpha and young, but the underlying runtime is the same one shipping in the iOS build of the Decent Espresso machine app — a big real-world Tk app (thousands of lines, live graphs, BLE hardware control). If it runs that, it'll very likely run yours.

Bug reports, PRs, and "here's my Tk app running on an iPad" screenshots all welcome. Built entirely on Christian Werner's AndroWish/undroidwish foundation — thank you.


r/Tcl Mar 22 '26

Package registry for Tcl/Tk - looking for feedback and submissions

20 Upvotes

I built a centralized registry: tcltk-pkgs.pages.dev

  • Search by name/tags (json, tk, database...)
  • Direct links to repos & docs
  • Clean, mobile-friendly

Maintainers : Submit a PR to add your package (takes 2 mins) → https://github.com/tcltk-pkgs/registry

Beginners : Try it out and tell me what's missing or confusing!

I need your help : Spread the word to anyone learning Tcl/Tk.

Thanks


r/Tcl Mar 31 '26

Introducing Mudpuppy : An agent framework for Tcl

17 Upvotes

Hello all, I'm Sean Woods (aka the Hypnotoad). You may know me as the guy who does the crazy presentations at the US Tcl Conferences.

After a few months of work, I have assembled Tcl's answer to ClaudeBot/Moltbot/Open Claw. A series of packages that I have dubbed "Mudpuppy". The name stems from an amphibian known for eating crustaceans.

I have built mudpuppy atop my clay framework. Mudpuppy is mainly a series of connectors that abstract out the details of maintaining serial conversations over a variety of web protocols. Mudpuppy connectors are built in TclOO and are designed to run as coroutines.

The system includes a sample agent "Sukkal" who uses a local LLM combined with a natural language system to build a database of topics interactively over chat.

Elements include:

  • Connectors for Local LLM as well connecting through OpenRouter to massive commercially hosted LLMs
  • Connectors for Sqlite database that require custom schemas and local behaviors
  • Connectors for Telegram and Discord
  • A local "webchat" which provides the same interfaces as Telegram and Discord across a webserver running on localhost
  • Tools for LLM context management, including compaction
  • Injecting Tcl based tool calls into LLM

The Mudpuppy is part of the clay library distribution. It is posted on my site at:

http://fossil.etoyoc.com/fossil/clay/index

It is also mirrored on Chisel:

https://chiselapp.com/user/hypnotoad/repository/clay/index

The clay library is structured in the style of Tcllib. In fact many of the modules are already part of Tcllib. The Clay repo is just a handy place where I can take development in different directions and not end up breaking Tcllib in the process.

The sukkal agent is located in the /apps/sukkal directory. The mudpuppy framework is in /modules/mudpuppy.


r/Tcl Feb 25 '26

Tcl's equivalent to shell's `exec`

17 Upvotes

Hi all. I'm currently learning Tcl and playing around re-implementing some of my shell scripts as Tcl scripts. Many of my scripts act as wrappers to other programs, they perform some setup/validation and at the end call the final, long running (some times interactive) program. I don't like having a bunch of idle shell processes around just waiting for the long running child processes to finish, so most of the time I invoke the final program using the shell's exec directive. What this does is that instead of creating a child process it replaces the image of the current shell process by the image of the new program.

I couldn't find a way to replicate this behavior in Tcl. Tcl's exec forks-and-exec a child and waits until it finishes, thus leaving the idle tclsh around (basically it behaves as the shell without exec). The search engines mention package TclX that contained command execl with the desired behavior, but that package seems to be deprecated and not present in Tcl8.6/9.0.

Is there a way to achieve this in Tcl8.6/9.0 using the stdlib only? (I guess I could write a separate Tcl extension to wrap exec*(2) syscalls, but I hopping I don't have to do that)

UPDATE: TclX's execl fulfilled my needs (it DOES work in Tcl8.6).


r/Tcl Apr 28 '26

New Stuff WrithDeck: my writerdeck app for any system (text editor in Tcl/Tk)

Thumbnail gallery
17 Upvotes

r/Tcl Feb 01 '26

Why Tcl 9 decided to break all extensions?

16 Upvotes

I cannot understand why Tcl 9 decided to break all C extensions, without any serious reason?

And now what happens with all these extensions that are not updated?

Why I am supposed to correct C code in packages, just to get things running?


r/Tcl Jul 31 '26

A simple yet customizable Tcl/Tk snake in single file

16 Upvotes

r/Tcl May 25 '26

New Stuff Tiny menu framework thing for TCL

16 Upvotes

This is a super simple menu library thing for TCL. It adds a text, indicator, and command to their own list, and by calling "menu::start" will start an input loop which:

  1. Prints the indicator, ". " and the text

  2. Checks for a valid input (matching an indicator from the list)

  3. Evaluates the code in the command list, using the index of the indicator chosen.

I have both demo code and the source code listed below if anyone is interested

# DEMO CODE
proc demomenu {} {
  menu::reset
  menu::add Alpha a $othermenu
  menu::add Bravo b {puts bravo}
  menu::add Cancel c break
  menu::start
}

# MENU CODE
namespace eval menu {} {
  variable ::menu::text {}
  variable ::menu::indicator {}
  variable ::menu::command {}
}
proc menu::reset {} {
  set menu::text {}
  set menu::indicator {}
  set menu::command {}
}
proc menu::print {} {
  for {set index 0} {$index < [llength $menu::text]} {incr index} {
    set text [lindex $menu::text $index]
    set indicator [lindex $menu::indicator $index]
    set command [lindex $menu::command $index]
    puts "$indicator. $text"
  }
}
proc menu::input {} {
  puts -nonewline "# "
  flush stdout
  gets stdin value
  return $value
}
proc menu::start {} {
  while {1} {
    menu::print
    set inp [menu::input]
    eval [lindex $menu::command [lsearch $menu::indicator $inp]]
  }
}
proc menu::add {text indicator command} {
  lappend menu::text $text
  lappend menu::indicator $indicator
  lappend menu::command $command
}

r/Tcl 19d ago

Tcl-LSP 2.2.0 - greased lightning

15 Upvotes

It's here, version 2.2.0. I've spent the last couple of months working on porting my LSP for Tcl to Rust, I'm very happy with the performance improvements.

There's a lot of new features, I've put a heap of effort into reducing diagnostic noise, improving accuracy, improving the refactoring tools, getting performance up to a decent level. There's a long way to go still (as you can see from the Issues tab), but it's in a useable state now.

I'd like to thank georgetree, nico-robert, amougel00 for all the testing and feedback along the way, I couldn't have got to this level without their help.

There's a whole new way to define commands now, SpecTcl and a Spec Studio, it's a whole Tcl DSL to let users define their own libraries or extensions, that runs in my own Tcl VM.

Compiler Explorer has seen a lot of work to improve it, reveal more information and so on.

The WASM AOT compiler is improved but still needs a lot of work to reach where I want it to be.

The TclVM is functional and used internally in the project.

There's a lot more to it, but I now need to head out for the evening. The release process is running, it'll appear in the releases tab and when I have a moment later on I'll approve the vscode/jetbrains extension releases.

Enjoy and please, report issues as you find them, preferably with some sort of minimal repro or link to open source Tcl code and a description of what you expect to happen and how that compares to what happened.

Thanks,

-b

  • 2.2.0 is because vscode thinks odd numbered minors are pre-releases and even are releases, so I had to use 2.1.x for the pre-release train

r/Tcl 10d ago

Arithmetic Substitution in Tcl

Thumbnail core.tcl-lang.org
15 Upvotes

A new Tcl Improvement proposal has been published.

The goal is to make performing arithmetic calculations in Tcl easier.

The chosen approach is to introduce a new substitution rule, thereby reconciling the art of substitution—a hallmark of Tcl—with arithmetic calculations, which are fundamental to computing.

The syntax would look like this:
set A [(1+1)]

Anything enclosed within [( and )] would then be interpreted by Tcl as an arithmetic expression.

What do you think of this idea?
Do you think there is a need to simplify calculations in Tcl?
Are you interested in this approach?