Tcl Tk

Tcl/Tk is a combination of ToolCommandLanguage and the Tk graphics kit used for developing GUI applications quickly. Tk is also usable in other language, but is probably mostly used with and tuned for Tcl.

What do you think about it?


Tk is one of the most powerful, most flexible and most portable GuiToolkits in the world. It is highly underrated, IMHO. Note that you can access it from other programming languages than Tcl. E.g. there is a very good Python binding for Tk. -- StephanHouben

Actually most scripting languages have bindings to Tk. I agree that it's a most excellent GUI toolkit... -- DavidDeLis

Tk is highly coupled with Tcl, and more or less requires it. Nearly all the bindings to Tk carry along Tcl as well, with all the penalties of size and speed that kind of overhead entails. There was once a project that successfully divorced Tk from Tcl, but it never kept up, and it's long dead now. -- ChuckAdams (going along with the non-anonymous nature of this page)

Sorry to spoil your barrel of honey with a spoon of tar. As someone who used Tcl for several months, but phased it out eventually, I have formed an opinion that it deserves to be "underrated". Not having a decent development environment is one big reason for this. Weird syntax features and plenty of "gotchas" in the standard library are another. GUI toolkit is OK, but "excellent"? Compared to what? -- AlexeyVerkhovsky

There are IDEs for Tcl, as an example you have "ActiveState's Komodo", http://www.activestate.com/Products/Komodo/

There is a book about Tcl programming with many free chapters online: http://www.invece.org/tclwise/ The first nine chapters can be used as a Tcl tutorial.


One can safely only use one "geometry manager" per display area/panel. Which is used should be associated with that area/panel, not the verb used to apply the geometry per widget (pack, grid, place, etc.). In this sense, the design of Tk seems to violate OnceAndOnlyOnce unless I am missing something about the design.


RichardSuchenwirth : Here's a nice little Tcl/Tk example, a digital clock in three lines of code (yes, this is the complete script, which can be run in a wish interpreter):

 proc every {ms body} {eval $body; after $ms [info level 0]}         ;# (1)
 pack [label .clock -textvar time]                                   ;# (2)
 every 1000 {set ::time [clock format [clock sec] -format %H:%M:%S]} ;# (3)

(1) creates a repeating timer (the body can stop it using return). (2) creates a label with an associated variable, and displays it on screen. (3) starts the clock by formatting current time into the variable, and re-does so every second.


Tcl/Tk has a wiki: TheTclersWiki


Tutorials


Tk looks bad on XP. Eugh, the Win9x/2K style buttons and the weird listbox icons. And before any Tclers get on to telling me it looks and feels almost as native widgets do - it is possible to do cross-platform, completely-native-where-possible toolkits.

I see no reason to content with less - JavaSwt/JFace and WxWidgets are both very good and easy to use GUI toolkits that give me efficient (look, ma, no embedded interpreter) full blown native widgets on half any platform, and most any language, certainly all programming languages I use. (That is, except SSharp. Yet.).

Why Tk then?

-- DavidVallner?

Obviously, when you want an embedded interpreter.


Tk was years ahead of its time. It provided a native-code GUI framework (Tk) that was scripted in a high-level language (Tcl). Tcl provided secure execution of scripts that could be loaded across the network.

Now we're all doing "Ajax" applications. We use a native-code GUI framework (DOM/CSS) that is scripted in a high-level language (Javascript). Javascript provides secure execution of scripts that can be loaded across the network.


See ToolCommandLanguage


CategoryProgrammingLanguage CategoryTcl


EditText of this page (last edited September 25, 2007) or FindPage with title or text search