Version 0 of An Interactive Approach to Experimenting with Tcl

Updated 2003-03-19 14:44:25

Purpose: Discuss the use of Tcl in an interactive manner. Pointers to relevant pages and tools are also welcome here.


Tcl can be used in several ways. This page talks about the user of Tcl in an interactive manner. Other pages [fill in some names here] discuss the use of Tcl with files, command lines, in web applications, etc.

So why would anyone ever use Tcl interactively? Tcl is an interpreter, and as such, interacting with it allows one to experiment with the language, as well as allows one to solve some kinds of simple problems.

So, how do you use Tcl in this way?

First, you have to find a Tcl interpreter. These can come named in various ways. A few of the more common ones are:

  • tclsh (This interpreter is usually the one generated when the Tcl source code distribution as distributed by the TCT is built)
  • wish (Tcl interpreter with the Tk extension initialized)
  • expect (Tcl interpreter with the Expect extension initialized)
  • tclkit (Tcl interpreter with Tk, incr Tcl, tclVFS, and Metakit bundled in)
  • bltsh (Tcl interpreter with Tk and BLT initialized]
  • tcldomsh (Tcl interpreter with TclDOM available)
  • tixwish (Tcl interpreter with Tk and Tix initialized)
  • tcl (Tcl interpreter with TclX initialized - this one is no longer being generated)

Next, you execute the Tcl interpreter. If you do this from a command line text type window, you will see a prompt of some kind - what kind depends on the interpreter. To assure yourself that you are in Tcl, type:

 info patchlevel

and you should get the version of the Tcl being used.

If the interpreter initializes Tk, you will also see a small blank window, which represents a Tk toplevel widget known as ".".

[Someone please fill in what someone from a GUI environment needs to do here.]

[To be discussed - use of console show on some platforms (and not others)]


See also TkCON - a great interface for interacting with Tcl.


Category Tutorial