Assigning a Callback

As usual, use the -command option to assign a callback for the widget. The callback is invoked every time the Scale value is changed. If you change the value from 50 to 100 and the Scale increment is 1, the callback will be invoked 50 times. The callback is also called when the widget is created. My recommendation is not to use -command unless you have a small number of possible values.

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.