Errata for the First Printing

This page lists errors for the 1st edition of Practical Programing in Tcl and Tk, the thin one with red printing on black.
ISBN 0-13-182007-9

Looking for 2nd edition errata?


The following errors were fixed in the 3rd printing of the book. You can tell the print run by looking for a sequence of numbers on the first page. The numbers count down from 10 and end when the print number. The third printing will end with 3:
10 9 8 7 6 5 4 3

There are three classes of errors :-(

  1. typos
  2. technical errors due to late changes in Tk 4.0
  3. font errors, especially commands like focus that are not in fixed font when they should be.

If you see an error not listed here or in the 2nd printing errata you can help me out by sending me some mail about it.

Preface

The WWW references on page xxxiii have been updated:

On page xxxvi my old email address is given. Mail to that address will bounce. You will always be able to reach me as welch@acm.org. Xerox PARC was a wonderful place to work, but the opporunity to work with Ousterhout in the Tcl/Tk group at Sun was too good an opportunity to pass up.

Chapter 1

On page 16 the entry for atan2 has some font errors with the parentheses.

Chapter 2

One page 19 the glob command is incorrectly listed as being described in this chapter.

Also on page 19, the otherargs should be surrounded by question marks to indicate it is optional.

Chapter 3

The chapter summary on page 29 should list the commands covered in the chapter:
set, unset, info, list, lindex, llength, lrange, lappend, linsert, lreplace, lsearch, lsort, concat, join, split, array.

On page 34, the first paragraph should end:
"that is currently at the specified index"

On page 35, Example 3-9 can use the end keyword in its use of lindex instead of computing the last index with expr and llength.

On page 38, there is a font error for id in the array nextelement description.

Chapter 4

On page 43 there should be a cross reference to the page 23 description of the scan command.

On page 44 the reference to Example 1-11 should be to Example 1-12, and it should include the page number (9).

Chapter 5

On page 50 in the last paragraph a space is missing after the first sentence, just before "There are".

On page 51 in the first paragraph of the Scope section there is also a space missing at the end of the second sentence, just before "There is".

Chapter 6

On page 59 the word "done" is mispelled in the first sentence.

Chapter 7

On page 63 the list of commands described in the chapter is incomplete. The chapter also covers file, puts, gets, flush, exit, pid, and the env array for environment variables.

On page 65 the description of file extension should be clearer that the dot is included in the return value.

Chapter 8

On page 76 in Table 8-1 there is a font error for pattern in the description of info vars

On page 78 there is a font error for eval in the second sentence of the Command Evaluation section.

On page 84 there is a space missing before "Goes into" in the first entry of Table 8-4.

Chapter 9

On page 91 the word "file" is used instead of "procedure" when talking about Library_UpdateIndex

On page 93 there are font errors for tk.tcl and auto_path.

Chapter 10

On page 96 there is a font error for wish towards the end of the second paragraph.

On page 98 the word "is" is missing from the third sentence of the second paragraph of section Naming Tk Widgets

On page 100 the page numbers for canvas and entry are slightly wrong. They should be 235 and 185, respectively.

On page 101 the description of the tk command should not reference color model, which went away late in Tk 4.0.

Chapter 11

On page 104 in Example 11-1, entry is mispelled "rntry".

On page 105 in Example 11-1, eof is mispelled "eeof".

On page 106 the phrase "the top frame" should be "the .top frame".

Chapter 12

On page 116 the height of frame .two is 50, not 100.

On page 124 there is an extra "is" in the second sentence of the Anchoring section.

On page 130 the discussion of the place command should mention that the absolute and relative width and size parameters (e.g., -width and -relwidth) are additive. You can make a window slightly larger or smaller than another by specifying both.

Chapter 13

On page 135 the default order of the binding tags is incorrect. The correct order is: widget, class, toplevel, all.

On page 137 Table 13-1 lists the Keymap event, which is no long supported.

On page 138 there is a font error for KeyPress in the first paragraph.

On page 144 Table 13-3 lists the %D substitution, which is no long supported.

Chapter 14

On page 150 the following sentence should be deleted: "Another way to define the radiobutton and get the correct value would be like this:"

On page 156 Table 14-3 omits the insert and postcascade menu operations.

On page 157 there is a font error for index and pattern in the left column of Table 14-4. Also in Table 14-4 the keyword end is omitted, which is a synonym for last.

Chapter 15

On page 164 "tk" should be capitalized in the first sentence of the third paragraph. (I programmatically down-cased this whole chapter by accident one day. There might be other capitalization errors in this chapter ;-)

On page 169 the word "is" is missing from the very last sentence.

Chapter 16

On page 172 in Table 16-1 the widget label is referenced instead of frame in the borderWidth and cursor rows.

On page 175 the use of \n in text to create multi-line labels and buttons should be described.

On page 178 in Table 16-5 the term "text" is used instead of "widget" in the borderWidth entry.

On page 183 Table 16-8 is missing the elementBorderWidth attribute. Table 16-9 is missing the delta operation.

On page 183 there are font errors in Table 16-9 for set in the get row, and for arrow2 in the identify row.

Chapter 17

I didn't find any errors.

Chapter 18

On page 204 the focus window description omits the optional -force flag that can forcibly take focus from another application.

On page 216 the first regsub pattern is wrong. It should be {^\.\./?}, but the \. got mapped into a superscript period by accident.

Chapter 19

On page 219 the semantics of the 1.end mark have changed to be the newline character instead of the character just before the newline.

On page 220 the insert operation can take multiple string tagList arguments.

On page 221 the description of - count lines should read "before the index". Also on page 221 the example defines a mark at the "beginning of the word", not the beginning of the line.

On page 222 the last example should have the two tags in a list:
{someTag someOtherTag}

On page 223 the -wrap attribute is omitted from Table 19-3.

On page 231 the bindings for the Cut, Copy, and Paste function keys are omitted. Those bindings manipulate the CLIPBOARD selection. Also in Table 19-5, the binding for delete word should be Meta-Delete, and the binding for Control-x should be removed.

On page 232 the insert description does not list the ability to insert multiple strings with different tags.

On page 232 the search description is not quite correct. Instead of supplying an optional varName argument, use the -count varName option to find out how many characters match the pattern. There is a -nocase option for case insensitive matching. There is no -nowrap option; instead you can supply an optional stopIndex.

On page 233 the tag configure, window cget, and window names operations are omitted. In the tag lower row, the word "before" should be "below".

On page 234 Table 19-7 omits the tabs, exportSelection, height, highlightBackground, and takeFocus attributes.

Chapter 19

On page 241 the description for arc style arcs is wrong, and so is Example 20-5 on page 242. They incorrectly use -fill to specify the color for arc style arcs. The -outline attribute to specifies the color in this case.

On page 242 Table 20-1 omits the -outlinestipple attribute.

On page 248 Table 20-6 omits the -width and -outline attributes for canvas polygon items that support outlines.

On page 253 the SetOfLabeledEntries command invocation has a typo. The command should read:
SetOfLabeledEntries $top.c.canvas $labels

On page 254 the last sentence before Table 20-11 should say:
$t is a canvas item ID or tag.

On page 255 there is a font error in the entry for the create operation.

On page 256 the xview and xview descriptions are incomplete. These standard operations have several variations that are described correctly in Table 19-6.

On page 258 the last row of the table should use "Width", not "Widget".

On page 259 the description of width incorrectly talks about characters for text. The width of a canvas is always specified in screen units.

Chapter 21

On page 263 Table 21-2 omits the -- option to clipboard append that is required if the data begins with a dash.

Chapter 22

On page 268 Table 22-1 omits the after idle command. This runs a command the next time idle handlers are invoked.

On page 272 there is a font error for $ and [ ] in the last sentence before the Using Sender section.

On page 274 the phrase "as separate arguments" should be "as a separate argument" in the last sentence of the second paragraph.

Chapter 23

On page 278 in Table 23-1 the list of widgets should use "and" instead of "or" in the description of the width and relief attributes.

On page 281 in Table 23-2 the list of widgets should use "and" instead of "or" in the description of the borderWidth attribute.
There is a font error for borderWidth in the bd description.
In the description of activeBorderWidth the term "border width" should be two words.
In the description of activeRelief there is an extra "a".

Also on page 281 the The Focus Highlight section should reference the highlightBackground attribute.
The term "width" should be used instead of "widget" in the last sentence of the first paragraph.
Table 23-3 omits the highlightBackground attribute.

Chapter 24

On page 286 Table 24-1 omits the highlightBackground attribute.

On page 288 the behavior of failed color allocations is wrong. Tk allocates the closest possible color instead of switching to a monochrome color model.
On page 288 Table 24-2 omits the best visual, which tells Tk to select the best visual for a given depth.

On page 290 first sentence of the second paragraph should read "that the Tk library parses".
Also in this paraphraph, there is a font error for bitmap.

On page 292 the list of image formats supported by the photo image type should list PPM, GIF, and PGM. You should also be able to find XPM and JPEG format readers in the Tcl archive if not in the main Tk release.

On page 292 the first sentence of the second paragraph should use "when", not "with".
The first sentence of the third paragraph should end "operate on it".

On page 293 the -decimate option to copy has been changed to -subsample.

Chapter 25

On page 300 in Example 25-3 catch is mispelled "ccatch".

On page 301 the default resizing behavior is incorrectly described. Windows are resizable by default, and you can control this with the new wm resizable command.

On page 308 the first regsub pattern should be:
{\(nil\)}

Chapter 26

On page 310 in Example 26-1 the first wm geometry command is missing its second argument, a dot.

This section should describe the new wm resizable command that controls the user's ability to resize a window interactively.

On page 311 Table 26-1 omits the wm resizable command.

On page 313 Table 26-4 omits the wm colormapwindows command.

On page 315 the second paragraph should use winfo exists instead of window exists.
The third paraghraph is missing "of the" in the second sentence.
The second paragraph of the Size section should contain "more or less", not "more of less".

On page 318 Table 26-10 omits the -displayof win option to the winfo atom, winfo atomname, and winfo pathname commands.
Table 26-11 omits the colormapfull and screenvisual operations.

On page 319 the tk colormodel operation is described, but this no longer exists. I use the following procedure to emulate this useful command:

rename tk tk-orig 
proc tk { option args } {
    switch -- $option {
	colormodel {
	    if {[winfo depth [lindex $args 0] > 4} {
		return color 
	    } else {
		return monochrome }
	    }
	default { return [eval {tk-orig $option} $args] }
    }
}

This chapter fails to mention the following new winfo operations: pointerx, pointery, pointerxy, server and viewable. The first three return the mouse coordinates and winfo server returns the version string of the X server. winfo viewable is an improvement on winfo ismapped because it returns true if the window and all its ancestors are mapped.

Chapter 27

On page 324 the paragraph between Example 27-3 and Example 27-4 has some extra sentences that really refer to Example 27-5.

On page 326 the text for the $f.cmd.l label should be Command:. The colon is missing.

Chapter 28

On page 330 in Example 28-1 the last if clause is truncated. The last few lines of that example should read:
if [file exists $basename-mono] {
    if [catch {option readfile $basename-mono $level} err] {
        Status "Error in $basename-mono: $err"
    }
}

This example uses tk colormodel and so the description should reference the emulation of this command.

On page 331 "If" is missing from the start of the third sentence of the first paragraph.

On page 335 wm is mispelled wwm in Example 28-7.

Chapter 29

The interface to Tcl_Main changed. It takes a third argument that is the application init procedure to call (e.g., Tcl_AppInit). On page 341 Example 29-1 does not reflect this change.

Chapter 30

The interface to Tk_Main changed. It takes a third argument that is the application init procedure to call (e.g., Tcl_AppInit). On page 354 Example 30-1 does not reflect this change.

On page 363 the incorrect man page is cited for the Timer Events section. It should be the TimerHndler man page.

On page 365 in the Geometry Management section the third paragraph should begin with "The Tk_MaintainGeometry procedure arranges ...".
The fourth paragraph of that section should begin with "The Tk_SetGrid call enables ...".

Chapter 31

On page 370 in Example 31-1 the tab stops are wrong so the comments are not lined up well.

On page 379 the word "button" is used in the comments of Example 31-7 instead of "widget" (or "clock").

On page 381 the second sentence should say "a focus highlight", not "and focus highlight".

Chapter 32

On page 394 there is a font error for simple_interactor in the last paragraph.

On page 397 there is a font error for send in the first paragraph.

On page 399 in the Connection Setup section the fourth sentence should begin with "The connection uses ...".

On page 401 there is a comma missing from the list of procedures in the first paragraph.

On page 403 Example 32-4 does not pass Tcl_AppInit to the Tk_Main procedure.

Chapter 33

On page 408 there is a font error for bindtags in the first paragraph of the Bindings section.

On page 409 there is a font error for focus in the first paragraph of the Focus section.

On page 410 there is a font error for padX and padY in the second paragraph of the Internal Button Padding section.

On page 411 the Menus section should reference the new insert and postcascade operations.

On page 412 Table 33-1 should list the new highlightBackground color.