[ Team LiB ] Previous Section Next Section

Chapter 34. The Entry and Spinbox Widgets

The entry widget provides a single line of text for use as a data entry field. The string in the entry can be linked to a Tcl variable. A spinbox is an extended entry that also allows the user to move, or "spin," through a fixed set of values.

Entry widgets are specialized text widgets that display a single line of editable text. They have a subset of the functionality of the general-purpose text widget described in Chapter 36. The entry is commonly used in dialog boxes when values need to be filled in, or as a simple command entry widget. A very useful feature of the entry is the ability to link it to a Tcl variable. The entry displays that variable's value, and editing the contents of the entry changes the Tcl variable.

Spinbox widgets, introduced in Tk 8.4, are entry widgets that include up and down arrows, allowing the user to "spin" through a fixed set of values such as dates or times. A spinbox normally allows a user to type any arbitrary text into the text area, but you can also configure a spinbox so that users can only spin through the valid choices.

    [ Team LiB ] Previous Section Next Section