Chapter 8. Tk GUI Programming with Tcl/Tk
In this chapter, we will cover:
Creating a widget
Writing to the console
Window manager
Creating a window
Destroying a window
Creating a custom dialog
Introduction
Up to this point, we have exclusively used the Tcl shell and its command set. While this is a wonderful method for writing scripts and non-graphical programs, it fails to provide the end user with a Graphical User Interface (GUI) to interact with. To allow for the creation and control of GUI and window elements, Tcl includes the Graphical Tool Kit (Tk).
Tk is a platform-independent GUI framework included in the Tcl package. By using the native Tk widgets and applying the correct theme, the GUI elements can be made to assume the native look and feel of the system on which they run, providing a polished appearance. Tk provides a full complement of window controls such as buttons, text boxes, and labels. In addition to the standard controls, Tk also includes several top-level dialog windows (for example...