Home Contact


Information you need to build high-quality Tk user interfaces.


Modern Tkinter ebook If you've found the material on this site useful, please consider purchasing this e-book (only $10), which is based on the Python material in the tutorial. Doing so helps me maintain and update this site. Thank you very much!



Kindle Buy now for your Kindle
Kindle apps are also available for most smartphones, tablets, and desktops. Payment and download handled by Amazon's Kindle Store.


PDF Buy the DRM-free PDF
Downloads handled by SendOwl.com. Payment handled via PayPal
(click "Don't have a PayPal account" to use a credit card).

These pages hold an archive of previous TkDocs weblog posts.

Happy 25th Tcl!

Note: check out discussion/reaction via Reddit and Hacker News — Mark

It struck me that 2014 marks 25 years since the programming language Tcl (Tool Command Language) escaped from John Ousterhout's lab at UC Berkeley and was unleashed on the world. I think that's a milestone worth recognizing, and indeed celebrating.

For anyone under 40 years old, you can think of Tcl like Ruby or Python, if those languages didn't have objects, if absolutely everything in them was treated as a string, and if every syntax rule added to the language resulted in its creator being tortured for one year.

Assignments? Math? We don't need no special syntax for those! What in any other language would be written as "a=b+c" in Tcl would be:

set a [expr {$b+$c}]

What's not to love? Sure, it's four times as long to do something really simple, but just admire the conceptual purity...!

In other words, Tcl as a language is what would happen if Lisp and csh met at a party, got way too drunk, hooked up, got pregnant, and kept drinking throughout the pregnancy.

And this is coming from a fan of the language.

Why was Tcl important?

John created Tcl as a scripting language to be embedded in other applications, so that each didn't create its own shitty configuration language from scratch. He also created a desktop graphical user interface toolkit for it, called Tk. Surprisingly, especially for John, people took his little add-on language and began creating substantial programs with it... no matter how much he begged them to stop. And because it was incredibly easy to hook up to C code, soon just about everything that had a C API soon had a Tcl API. Or ten.

For most people though, myself included, Tk was the real selling point. This was a time when most of the innovative programmers were working on Unix-based systems running X11. Back then, doing a "Hello World" program in X11 was hundreds of lines of code, but Tcl and Tk reduced it to just one:

pack [button .b -text "Hello World" -command exit]

Yes, only about twice as long as our simple addition/assignment statement from before.

Tcl and Tk took off with the cool kids in the early-mid 90's, peaked around 2000, and interest gradually eroded since then. It had its share of successes and controversies (if you want some historical entertainment, Google "Why you should not use Tcl"), organizational transitions and missed opportunities (did you know that Tcl almost became Javascript?). You can find more at the Tcl history page at www.tcl.tk.

Lasting influence

Despite the ridiculous syntax, Tcl did a ton of things right, well ahead of its time. The internal code quality has always been top-notch, and backed up by a rich automated testing suite. The complex implementation details of two language development, scripting, language extensions, and how to manage backwards compatibility and deployment in that kind of dynamic environment were greatly refined by Tcl over the years. Very early versions aside, Tcl was also wicked fast, I18N-savvy, and cross-platform.

While there's not a lot of new projects started with Tcl anymore, there's still a whole lot of legacy code out there, both scripts and applications written in Tcl, and all kinds of programs that have Tcl embedded inside them.

And of course, lots of other languages borrowed ideas and code from Tcl. Most notable is Tk, which became the defacto standard desktop GUI for just about every other scripting language, including those still in common use today such as Python (tkinter), Ruby (RubyTk), and Perl (Tkx).

Tcl was after all designed as a language to be embedded in other programs, so it's only slightly perverse to think that even other programming languages embed a Tcl interpreter.

And while desktop user interfaces have largely been supplanted by the web or mobile platforms, you'd be surprised how many people are still plugging away with Tk (whether from Tcl, Python, Ruby or some other language).

It's just one data point, but this site (TkDocs.com), which provides relatively up-to-date cross-language documentation on how to use the more modern features in Tk, gets over 10,000 unique visitors each month, and a Python-specific ebook version of the material (Modern Tkinter) still sells 50+ copies a month.

Standing on the Shoulders of Giants

A skit I wrote a few years back tackles the question of Is Tcl/Tk Dying Out?. But old programming languages never really die, they just tend to stagnate over time.

In the tech industry we're often too quick to throw things out and ignore lessons from the past. It's nice to know that some of the great ideas, principles, and yes, even code from Tcl continue to be built on even today. And there's still a core group of people slowly but surely working on the language itself.

So, 25 years after the beast was released, I just wanted to say thanks to the many thousands of people who contributed their time and energy over the years.