scrollbar

proc autoscroll { scrollbar first last} {
    if {$first <= 0 && $last >= 1} {
 grid remove $scrollbar
    } else {
 grid $scrollbar
    }
    $scrollbar set $first $last
}


itk_component add viewcryst_scroll {
 scrollbar $itk_interior.iscroll \
      -command [code $this component treectrlcom yview] \
      -orient vertical
     }
     
$itk_component(treectrlcom) configure \
     -yscrollcommand [list autoscroll $itk_component(viewcryst_scroll)]
 
grid $itk_component(treectrlcom) $itk_component(viewcryst_scroll) -sticky nswe
     

原文地址:https://www.cnblogs.com/greencolor/p/2182524.html