|
February 2002
Regular Expressions: What You Should Know about Tk
by Cameron Laird and Kathryn Soraiz
Last month, a correspondent speculated that "there are probably more users of Tk outside of Tcl (perl, python, ruby) than in Tk/Tcl." That's a good subject for "Regular Expressions" to explain.
Toolkit and Language and Library and...
Let's be clear what we're talking about. Tk (http://mini.net/tcl/Tk)is the graphical toolkit maintained along with the core distribution of the Tcl language. Although John Ousterhout, creator of Tcl, sketched a crude version of Tk in 1988, the first one usable outside his laboratory appeared in 1990. Since then, Tk has emphasized portability (binaries are available not only for Unix, but also MacOS, Windows, and even OpenVMS), ease of learning ("Hello, World" is a one-liner), simplicity (Tk is used in many mission-critical and long-running "control panels" that can't tolerate memory leaks or other software surprises), and compatibility with other software (Tk is often the "glue" that reshapes existing programs).
What's confusing for newcomers to Tk is that this body of portable, easy, simple, and compatible open-source graphics code appears wrapped up in several different packages. Sometimes when programmers talk about Tk, they have in mind the Tk language. As a language, Tk includes all of the Tcl base, plus five dozen additional commands such as button and font.
When someone talks about "running Tk," or "installing Tk," he or she typically has in mind the Tk language processor. This is wish (or wish.exe under Windows), the "windowing shell" executable. wish is what you need at run-time either to interpret Tk scripts, or just interactive sessions you might choose to launch.
|