When using scrollbars, Tk library passes parameters to the widget
associated to the scrollbar (and vice versa). Let us look at a
text widget with an associated scrollbar. When the scrollbar is moved,
the command of the associated widget is invoked to change its view.
On the other side, when browsing the content of the text widget (with
arrows for example), the scrollbar is updated by calling it's
associated closure. Tk library passes position informations to
scrolling closures. This informations are the parameters of the
closure. Hereafter is an example implementing a text widget with a
scrollbar (see the help pages for details):
unspecified
error
makeotherˆ`=̀13`
gobblecr(text '.txt :yscrollcommand (lambda l (apply .scroll 'set l)))(scrollbar '.scroll :command (lambda l (apply .txt 'yview l)))(pack .txt :side "left") (pack .scroll :fill "y" :expand #t:side "left")