A Bit About Tcl And Tk

Tcl

Tcl is a programming language intended for casual programming. Its main strength is in "gluing" together various applications, and in being embeddable inside other applications. The Tcl plugin demonstrates Tcl's second strength, that of being embeddable inside other applications, in this case your browser.

Several properties of Tcl make it an efficient way to quickly construct your application: first of all, it is interpreted which means that when you've written your program, it is immediately ready to be executed, without further preparation. Thus, you get to see immediately what your creation looks like. Second, Tcl encourages incremental development of programs, because it won't complain if you give it an incomplete application, as long as you don't venture into those areas of your program where the scaffolding is still showing. Third, Tcl enables iterative, and interactive, development. You can start your application running, diagnose a bug, fix it in the source file and read the source file into your running application, without ever having to stop and restart it.

If you are not familiar with Tcl, or if you need a refresher, the source code for most of the Tclets that follow will not make a whole lot of sense to you. If that is the case for you, please visit our quickie Tcl tutorial section.

Tk

The button we saw in the first Tclet is actually implemented by Tk, an extension of Tcl for doing graphical display stuff. Because it is so important and central to most Tcl programs, many people don't make a distinction any more between Tcl programs and Tk programs. When we're writing Tclets, we'll always be using Tk to do graphical interfaces, and we'll also use Tcl heavily.

The Tk graphical toolkit comes with ten widgets (this is the name we use for graphical elements such as buttons that appear on a display). There are several sets of widgets written by other people that extend Tk and work harmoniously with it; for example, the Tix widget set contains more than forty additional widgets. To be able to use these widget sets, you must install Version 2 of the plugin; see this page for how to use extensions such as Tix.

Tk also provides three geometry managers. These are commands for grouping widgets together on a display and managing their geometry, visibility, layout and spacing.

Tk lets you manage color maps, fonts, cursors, images and other display resources. Tk also allows you to modify or extend the behavior of its widgets through bindings, commands that are executed in response to display related events such as mouse cursor movement. Finally, Tk provides a way to schedule events to occur at a later time, which allows you to create special effects and delayed behavior.



comments?