TCL/Tk was developed by John Ousterhout, and it has achieved wide popularity. TCL, Tool Command Language, was developed to be an embeddable language. It provides a simple easily extensible string based language which allows developers to customize it for their particular application. Tk is a binding of graphical widget functionality to TCL. This allows widgets to be accessed directly from a simple interpreter.
The Tk widgets were chosen for Glish because they have been extensively used and are robust in an interpretive environment. It is very important that widgets which are used interactively handle bad input with grace. Tk is somewhat unique in this respect. Most widget toolkits are designed to be used as linkable libraries and are therefore intended for programmers rather than end users. As a result, these library toolkits have not tended to be very robust.
The problem, however, comes from the fact that TCL and Tk are very tightly coupled. Tk has been bound to many other languages, but this is most often been done using TCL as an intermediate language. So essentially, a whole new interpreter must be carried along to get the benefits of the Tk widgets. Brian Warkentine, however, developed a C library for TK which has most of TCL removed; this library is called Rivet. The Rivet library was chosen for Glish because it avoids the extra overhead of TCL evaluation in the widget creation process. This library has worked out very well, but unfortunately, it is now quite out of date with the current TCL/Tk release.
When the term Glish/Tk is used, it refers to Glish with the optional Rivet library linked in. Glish without this optional library is referred to as Glish, and when the Tk widgets have been moved into a client the name Glish/Tk will go away completely. When the term Tk is used in this chapter, it refers to the graphical widgets in Glish/Tk and not to the Tk in TCL/Tk.
In creating Glish/Tk, every attempt was made to fully integrate the widgets into Glish, and as a result, it is not simply a binding of the Tk widgets to yet another language. In Glish/Tk, the widgets are synonymous with Glish clients. They are agents which the user creates with functions. Once created, these agents generate and respond to events. The events which they generate are almost always the result of user interaction with the widgets. The events generated by the Tk agents are handled just like any other events in Glish.
While Glish/Tk is quite usable, it is not yet complete, and as a result, not all of the features found in TCL/Tk have made it into Glish/Tk. In addition, this chapter only gives an introduction to Tk. For more information about Tk, I would recommend ``Practical Programming in TCL and Tk'' . Information about the version of Tk etc. being used is available as follows:
print system.tkfurther information may be available in the attributes of this value:
For most of the Tk widgets, a table is provided which lists the events that the widgets accepts or generates. Table 10.1 presents the meaning behind the arrows in these tables. These arrows provide a shorthand notation for indicating event flow between Glish and the widget.
I/O Description event sent from Glish and accepted by the widget event generated by the widget request/reply event either or event