O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Scrollbars

The following commands create a text widget and two scrollbars that scroll it horizontally and vertically:

scrollbar .yscroll -command {.text yview} -orient vertical
scrollbar .xscroll -command {.text xview} -orient horizontal
text .text -yscrollcommand {.yscroll set} \
   -xscrollcommand {.xscroll set}

The scrollbar's set operation is designed to be called from other widgets when their display changes. The scrollable widget's xview and yview operations are designed to be called by the scrollbar when the user manipulates them. Additional parameters are passed to these operations as described later. In most cases you can ignore the details of the protocol and just set up the connection between the scrollbar and the widget.

Example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required