Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8246291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:27:30+00:00 2026-06-07T22:27:30+00:00

I tried all sort of options but no success in implement simple scrollbar for

  • 0

I tried all sort of options but no success in implement simple scrollbar for two or more listboxes. Following is my code giving error while scrolling. I hope you guys are helping me…

scrollbar .scroll -orient v
pack .scroll -side left -fill y
listbox .lis1
pack .lis1 -side left 
listbox .lis2
pack .lis2 -side left 

for {set x 0} {$x < 100} {incr x} {
 .lis1 insert end $x
 .lis2 insert end $x
}
.lis1 configure -yscrollcommand [list .scroll set]
.lis2 configure -yscrollcommand [list .scroll set]
.scroll configure -command ".lis1 yview .lis2 yview ";

thanking you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:27:32+00:00Added an answer on June 7, 2026 at 10:27 pm

    There are a number of examples on the Tcler’s wiki, but the core principle is to use a procedure to ensure that the scrolling protocol is synchronized between the widgets. Here’s an example based off that wiki page:

    # Some data to scroll through
    set ::items [lrepeat 10 {*}"The quick brown fox jumps over the lazy dog."]
    
    # Some widgets that will scroll together
    listbox .list1 -listvar ::items -yscrollcommand {setScroll .scroll}
    listbox .list2 -listvar ::items -yscrollcommand {setScroll .scroll}
    scrollbar .scroll -orient vertical -command {synchScroll {.list1 .list2} yview}
    
    # The connectors
    proc setScroll {s args} {
        $s set {*}$args
        {*}[$s cget -command] moveto [lindex [$s get] 0]
    }
    proc synchScroll {widgets args} {
        foreach w $widgets {$w {*}$args}
    }
    
    # Put the GUI together
    pack .list1 .scroll .list2 -side left -fill y 
    

    It’s worth noting that you can also plug any other scrollable widget into this scheme; everything in Tk scrolls the same way (except with -xscrollcommand and xview for horizontal scrolling, together with a change of scrollbar orientation). Furthermore, the connectors here, unlike the ones on the wiki page, can be used with multiple groups of scrolled widgets at once; the knowledge of what is scrolled together is stored in the -command option of the scrollbar (first argument to synchScroll callback).


    [EDIT]: For 8.4 and before, you need slightly different connector procedures:

    # The connectors
    proc setScroll {s args} {
        eval [list $s set] $args
        eval [$s cget -command] [list moveto [lindex [$s get] 0]]
    }
    proc synchScroll {widgets args} {
        foreach w $widgets {eval [list $w] $args}
    }
    

    Everything else will be the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried all scaletypes, but all of them result in the image to be
I've tried all the time calculating examples I found on this site but somehow
I have tried all the solutions that have been provided including using PRAGMA but
I have 2 path objects in my android code.I have tried all the way
I've looked high and low, and tried all sorts of things, but it simply
I have tried all of these various ways to set the value of the
I have a problem with random number generating in C# I have tried all
Am newbie in KnockoutJs , i tried all tutorials on its official website. Now
I found already about 5 answers, tried all of them and didn't get it
Please check my website out: http://www.budgie.richardcmpage.com/index.php I've tried all sorts and can't get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.