Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

Chapter 10. The Scale Widget

A scale widget is a strange little widget. It's similar to a scrollbar because it is long and skinny with a button in the middle of it, but it doesn't scroll anything other than itself. It does keep track of something though—a number. When you change the position of the button in the scale, the value associated with the scale changes. Here are some things you can do with a scale widget:

  • Create a widget from which a user can select a number between 1 and 100.

  • Create three scales, each representing a value in an RGB (red, green, blue) number.

  • Create four sliders, each representing a portion of an IP address. Each scale can go from to 255, and it would probably be smart to start them at 255. Use a label widget to show the completed IP address, periods and all.

  • Create a temperature scale that starts at -50 and goes to 130 degrees.

  • Show the amount of rainfall so far this year. The scale can be marked to show every five inches.

The scale widget can be placed horizontally or vertically, depending on where you have the most room in your application window.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata