Scale Widget

Contents:

Creating a Scale
Assigning a Callback
Orientation
Minimum and Maximum Values
Displayed Versus Stored Value
Adding a Label
Displaying Value Increments
Changing the Size of the Scale
Options You'll Probably Never Need
Configuring a Scale
Getting the Value of a Scale
Setting the Value of a Scale
Determining Coordinates
Identifying Parts of a Scale

A Scale widget looks similar to a Scrollbar but doesn't scroll anything other than itself. What it does is keep track of a number. When you change the position of the button in the Scale, the numeric value associated with the Scale changes. Some things you can do with a Scale widget are:

The Scale widget can be placed horizontally or vertically, depending on where you have the most room in your application window. Figure 10-1 shows a scale widget. Figure 10-1

Figure 10-1. Scale widget

Creating a Scale

As with other widgets, to create a Scale, use a parent widget and pass options to the Scale to change its configuration:

$parent->Scale( [ option => value ] )->pack;

Use one of the geometry managers discussed in "Geometry Management" to place it on the screen (such as pack, as shown in the preceding code).

Most of the options associated with the Scale widget are standard options used with all other widgets. All the possible options are in the following list. A discussion of special options that have slightly different meanings for the Scale and options that are specific to the Scale widget follows the list.