Expectk
You can include the Expect and Tk extensions together when you build your Tcl-based application. Alternatively if you have Tk installed on your system, the Expect Makefile automatically builds a program called Expectk.
Expectk is a mixture of Expect and Tk. Most of the commands work as before. However, some new commands exist and some old commands have different names.
The most common use of Expectk is to take existing command-line-oriented programs and wrap them with X GUIs. As with Expect, no changes have to be made to the original programs.
Wrapping existing programs avoids several common problems. For example, changing an underlying program requires that you test the result, including features that were working before you touched the program. And it is much more work to test GUIs than to test command-line interfaces. Another problem is version control. If you modify a program, you will have two versions of the original program to maintain—a command-line version and a GUI version. And of course, all of these problems presume that you have the source in the first place, which is often not the case.
Expectk allows you to focus on the GUI, since the original application already exists. This reduces the amount of testing that has to be done and avoids version problems—you will be using the same version of the application whether you use its command-line interface or its GUI interface.
All of the benefits of Tk itself carry through to Expectk. Scripts are much shorter than their ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access