BOOK: Tcl/Tk 8.5 Programming Cookbook

Tcl/Tk 8.5 Programming Cookbook

by Bert Wheeler

https://www.packtpub.com/sites/default/files/imagecache/productview/2985_Tcl.jpg

[Description from the above web site]

This book will take you through all the steps needed to become a productive programmer in Tcl/Tk 8. Right from guiding you through the basics to creating a stand-alone application, it provides complete explanation of all the steps along with handy tips and tricks.

The book begins with an introduction to the Tcl shell, syntax, variables, and programming best practices in the language. It then explores procedures and the flow of events with control constructs followed by advanced error trapping and recovery. From Chapter 4, a detailed study of string expressions and handling enables you to handle various string functions and use lists to expand the string functionality. The book then discusses in-depth the Tcl Dictionary and how to utilize it to store and retrieve data. File operations and Tk GUI handling are covered extensively along with a developing a real-world address book application to practice the concepts learned.

A practical, comprehensive cookbook to master the depths and breadths of Tcl/Tk 8 programming

What you will learn from this book :

  • Expand your Tcl/Tk abilities by gaining in-depth knowledge of the core commands
  • Learn efficient programming by using control constructs in your program
  • Handle numerous types of string expressions by performing formatting, searches, and advanced manipulations on them
  • Gain expertise in using lists with examples teaching you the various available operations
  • Demystify the Tcl Dictionary and learn how it can be a viable substitute for a third-party database
  • Perform various operations on the dictionary elements in both single and multiple layer dictionaries
  • Create, manage, and empower your Graphical User Interface with Tk window management, to develop attractive applications
  • Ease your file system access with an in-depth study of File operations
  • Perform advanced error trapping and recovery with error handling commands in Tcl

Approach

This book provides a step-by-step approach to the Tcl/Tk language with the help of re-usable examples and images. It is a series of carefully organized, easy-to-follow, standalone recipes to solve your queries. Whether you go through the recipes chapter-wise or pick up any recipe randomly, you will find clear and complete explanation of the task covered in the recipe.


Reviews

RLH - 2010-12-29 10:38:11

Did anyone do a review on this book? Edit: It is out in Feb 2011.

There was some discussion on comp.lang.tcl [L1 ]

MHo - 2011-03-09: Seems to me that this book is more oriented towards tcl newcomers. I didn't find many things new to me, with the exception of a good explanation of dictionaries. However, that doesn't mean that this book isn't good - the explanations are clear and understandable. But I'd expected something else... maybe I've ordered a little too fast.

DKF: A review was done by WJG.

HaO 2010-03-11 Here is my review: [L2 ]


siqsuruq - 2011-03-09 17:41:57

I have the BOOK Tcl 8.5 Network Programming from the same publisher. They print good books.

Bryan Oakley - 2011-03-10

My only other experience with the publisher is with the wxPython cookbook and it is very good.


WJG (10/03/11)

When I received my review copy of the Tcl/Tk 8.5 Programming Cookbook I was half expecting a rewrite of the manual -lists of features and functionality with little indication of how and when to use specific resources. I was wrong. Let me explain. A cookbook is something to turn to when you’ve run out of ideas or perhaps are looking to find some new way of tackling an old problem. Alternatively, cookbooks are for beginners and novices, those people who need to know how do something effectively and quickly. In this area the ‘Cookbook’ score points in every chapter. Turn to any page in the text and you will find a clear, structure on how to use Tcl/Tk to resolve particular issues. There is a task statement, such as 'Creating a List’ in which a particular requirement is identified followed by 'How to Do It’ code snippet and 'Why it Works’ explanation. For someone new to Tcl programming this is an excellent approach.

Overall, the ‘Cookbook’ is organised over thirteen chapters which cover all the key areas any novice Tcler needs to know. The flow of the book first introduces the reader to the key aspects of Tcl: the shell, program control, error handling, string manipulation, lists, dictionaries (particularly useful) and file operations. Following this it deals with the creation and configuration of GUIs using the Tk widget set and the use of in-built dialogs and the creation of menus. Finally, the issues and decisions surrounding the completion of a first Tcl/Tk project are examined in the form of an address book application.

Conclusion The Tcl/Tk 8.5 Programming CookBook is exactly what it set out to be - a practical tutorial text. It doesn’t cover the advanced features of Tcl/Tk but this is intentional. Would I recommend this book to a Tcl/Tk newbie? Yes.

RLH - I am going through the book now as a review and will post mine here as well. I am probably more to the beginner side of things, so that will be my viewpoint in the review.

AM I have a copy now myself, and I will post my comments here (I qualify for the other end of the spectrum)


AM (19 may 2011) It took me a while to get around to actually write up my conclusions. But here they are:

The book is set up to describe and illustrate all the main commands of Tcl/Tk. It does so by presenting each command in turn with its options. The advantage of this choice is that you can see what the command does, in quite some detail. However, you do see it in isolation.

The book is not a tutorial, nor aims to be one. SO, I think it is very useful for people who have learned the basics of Tcl and want to check how to use a particular command. In addition they should have some experience in programming in Tcl, to know what command they are looking for.

Strong points

  • Emphasis on tclsh and wish in interactive mode to experiment with the various commands.
  • Overview of the commands with their options.
  • Presentation of the effects of these commands in isolation.

Weak points

  • For some commands the real power is not shown. When he describes foreach, the author does not present iterating over several loops at the same time for instance. The most common use of grid is missing as well:
     grid .widget1 .widget2 .widget3
     grid .widget4 .widget5 .widget6
  • A command like expr is treated at the start of the book, but it does not have much context. I would have preferred a more prominent presentation.
  • Some text is repeated too often, this hinders reading the book in my view and some personal remarks are out of place. But that is a minor issue.

Possible extras

  • An appendix with a description of Tcl's syntax - the dodecalogue, as it is fondly called.
  • A chapter on the typical use of the various commands - the idiom (it may be a bit out of scope, but it would help putting the commands in context, I think)
  • One or two more elaborate examples, to better understand how all the pieces fit together.