Do you think Tcl/Tk GUIs are doomed to look outdated?

Fear not!

Forest light theme

A treeview widget:

The official example of Forest Light:

The ttkthemes gallery

Plus, Tk itself has a little choice of built-in themes:


We can use these themes with nodgui, the Ltk fork.

In June of 2020, @cage added a little function to load a .tcl file:

(defun eval-tcl-file (file-path)
  "This function will feed the TCL interpreter with the contents
   of the file `path'.
   Please, as this function will load  and execute a script, ensure to
   load files only from trusted sources otherwise severe security problem
   may arise."
  (assert (stringp file-path))
  (format-wish "source {~a}" file-path))

As a consequence, we can load a .tcl script that defines a theme, and use it. Themes generally consist of a .tcl script and a directory of png or gif images (when images are not defined in-line).

Considering we cloned the ttkthemes repo locally:

  (with-nodgui ()
    (eval-tcl-file "ttkthemes/ttkthemes/png/yaru/yaru.tcl")
    (use-theme "yaru")

and that’s all there is to it.


For now, some themes are not supported. Scalable themes are not supported, the .gif based themes of ttkthemes won’t load (the “scid” and “smog” themes in ttkthemes, the Sun Valley theme didn’t work). This could change when tksvg lands in Debian (or maybe, if you install it yourself? I didn’t try), or with the next release of Tcl/Tk that will include SVG support (read #13).

Frankly, that was a great news of the day. Yes, I think some themes are pleasant to the eyes! This makes me want to use little Tk UIs here and there.

Here’s the code for the little media player of the screenshots. It is based on Peter Lane’s extensive examples.

Kuddos to @cage o/