[Sample TK Application]

Tcl/Tk for Programmers

J Adrian Zimmer

[Book's Cover]
Run This Program Order from Amazon.
July 2014. The book still sells at its slow pace. However the tcllet links from these pages no longer work.

Check out my new ebooklet, From Simple IO to Monad Transformers

Tcl is a scripting language something like Perl but extensible and somewhat cleaner. Several extensions are available. Tk is an extension developed by the creator of Tcl and used for creating scripts that interact with users through windows. Tcl can act as a Unix shell and Tk was originally developed to create windows for the X Windows environment. Tcl was meant to be portable and Tcl/Tk has been ported to versions of Microsoft Windows and to the MacIntosh. A version of Tk that runs in Perl was created long ago and Tk now ships with both Python and Ruby.

Tcl/Tk for Programmers is published by the IEEE Computer Society Press. The ISBN is 0-8186-8515-8. There are 544 pages (most online catalogues have this wrong) divided into major sections: "Tcl," "Tk," and the "C/C++ Connection." There are over 200 solved exercises that have been tested on Unix and Windows 95. The current versions of Tcl/Tk add to, rather than alter, earlier versions. Additions have been minimal. This book was finished as version 8.1 was in experimental form and you will find the material up-to-date.

Reviewers of this book, at Amazon and in private communications, have pretty much presented a consistent message. This is not a "quick start" book. The book is meant to be read and the exercises are meant to be worked, or at least studied. The positive reviews often say something like "I wish I had had a book like this when I was first learning Tcl, it would have saved me a lot of time."

Unfortunately, to save that time, you have to spend some time on the front end. That approach is not for everybody. You may not want to buy this book for your first venture into Tcl/Tk. On the other hand, you may want to buy it the first time you get into serious trouble with your script. You probably won't uncover a silver bullet in its pages but you should be able to achieve a deeper understanding of those "features" which are giving you difficulty and a kind of programming style that helps keep you out of trouble.

I believe Tcl/Tk for Programmer's consistent, but low volume, sales over the better part of a decade, attest to its lack of sex appeal and its substantive value for a few readers. At the outset, the publisher and I agreed to post 25% of the material on the web so you can make up your own mind.

Here's the table of contents with links to sample chapters covering introductory material in the Tcl and Tk sections as well as the chapters on regular expressions and the browser plugin. Here is an errata sheet for the entire book. Please let me know if you discover any unmentioned errors.

The book promises that some Tcl/Tk scripts and C programs will be available on line. My choices of what to put online had more to do with what is helpful for subsequent exercises than with what will look good here. View them with that understanding. Example Tk Canvas

Two tclets are provided to exemplify points in the book: one for experimenting with canvas polygons and lines and one for experimenting with Safe Tk.

I believe this book devotes more pages to writing Tcl extensions in C than any other. Extending the GUI environment in Tk, however, is not covered at all.

Here are some online examples not included in the book.