Member Contributed Articles
1995a: Using Tcl and Tk
(by Guy Bzibziak; February 15, 1995)
BCS Linux & Unix User Group
Meeting Notes - Wednesday, February 15, 1995
minutes by Guy Bzibziak
(guybz@world.std.com)
Meeting Topic: Using Tcl & Tk
Member Robert Luoma presented this month's topic of using Tcl & Tk (Tcl = "Toolkit control language"; Tk = X extensions to Tcl). His talk described his experiences in learning and using these two scripting tools in performing various tasks on his computer.
As Robert explained, this basically was his first considered use of these tools, having picked up John K. Ousterhout's "Tcl and the Tk Toolkit" just about ten days earlier. Ousterhout first implemented Tcl back in the late 1980's, out of the need for a reusable, extensible tooklit language that had the ability to use C language libraries, and yet be accessible through scripts or a command-line mode.
His experiences, as described to our audience, showed that while Ousterhout's book gives a thorough coverage of the Tcl & Tk, it is not the easiest reading instructional source for beginners, causing Robert to cast about the 'Net for further examples, as Ousterhout's book was the only printed source at this time. Some additional sources were a review draft of a forthcoming book, "Practical Programming in Tk/Tcl": ftp://parcftp.xerox.com/pub/sprite/welch, which in Robert's opinion gave more concrete examples to learn from.
Tcl's interpreter is a library of C routines, that can be embedded in C programs, or can be used to write X applications; Tk being the X extension of Tcl. Tcl is an interpreted script language, with syntax similar Bourne shell scripting, or to Perl's. Variables, procedures, loops, file I/O and more can be performed using Tcl.
Robert showed how quickly a simple program for X could be written by creating a small box that displayed "Hello, World!" and would react to certain mouse clicks, within about two minutes from start to finish. He also showed what could be done with "wish" (window shell), in performing basic tasks like retrieving file names for further action, or drawing various shapes and curves on a canvas.
From these simple beginnings, Robert showed that Tcl and its extensions (Tk, embedded Tcl and Expect) are indeed valuable tools, not just for those with a programming bent, but for anyone who wishes to "roll their own" utilities.
Several minutes of questions and answers followed the main presentation, on the night's main topic and other items.
Some additional sources of information:
-
Tcl and the Tk Toolkit.
Ousterhout, John K.
(Addison-Wesley Publishing, ISBN 0-201-63337-X)
- Linux Journal:
- Dec. 1994: Welsh, Mat.
X Window System Programming with Tcl and Tk
- Feb. 1995: Welsh, Mat. Using Tck and Tk from Your C Programs
- "Practical Programming in Tk/Tcl": ftp://parcftp.xerox.com/pub/sprite/welch/
Software sources:
- Tcl/Tk
-
http://sunsite.unc.edu/pub/Linux/devel/tcl
- tsx-11.mit.edu: /pub/linux/...
- Embedded Tk
- ftp://ftp.std.com/pub/drh/etl.ltar.gz
- Expect
-
sunsite.unc.edu: /pub/Linux/...
- tsx-11.mit.edu: /pub/linux/...