Version 5 of When all you want is to run a Tk application

Updated 2002-01-29 15:57:02

Suppose someone's given you an application, saying, "Here; this is really cool. You should run it on your own computer and see." If Tk was used to develop the application, and you're unfamiliar with the Tcl/Tk language, you might not know what's involved in "running it on your own computer." Here's an explanation of the minimum you need to know:

You likely don't have Tk installed on your desktop. It won't take long to change that, though. For quickest results, you'll pick a "working directory" on your desktop, transfer a couple of (kinds of) files into it, and launch a process. At that point, the application will be running.

The two (kinds of) files are

  • the Tk interpreter, and
  • the Tk application source.

Your acquaintance has probably already given you the application source, likely named something like 'myprogram.tcl'. Make sure you have a copy of that in your working directory.

Now, copy in a working Tk interpreter. The easiest way to do this is by choosing the TclKit binary appropriate to your operating system. You might, for example, retrieve the December 2001 Windows preview [L1 ].

At this point, you have a copy of files in your working directory (or perhaps more; your acquaintance might package his work as a bundle of several distinct-but-related files). While at the "command prompt" specific to your operating system, move to the working directory, and enter the command

    tclkit myprogram.tcl

After a few seconds, the program will begin to execute. That's all.

myprogram.tcl is likely a "plaintext" source, so you can examine it with any common editor, and modify it as you choose. Once you've made a change, launch an instance of the updated application by repeating the command

    tclkit myprogram.tcl

at the prompt.

[Present Tk to those who just want to run an application, and perhaps tinker with its source, but have no other on-going interest in Tcl. Point to ActiveTcl and TclKit. Explain how source looks, and how to invoke. Subtleties of multi-file source.]


Category Tclkit