Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#################################### # scrollbars #################################### # Setup two individual horizontal scroll bars for the text windows # Setup vertical scroll bar for both text windows $yscroll= $topframe->Scrollbar()->pack(-fill => 'y', -side => 'right') +; sub scroll_both{ my ($sb,$wigs,@args) = @_; my $w; foreach $w (@$wigs) { $w->yview(@args); } } # Create Right Text widget... my $text = $topframe->Text(-wrap => 'none' )-> pack(-expand=> 1, -fill=> 'both', -side=> 'right'); # Create Left Text Widget... my $text2 = $topframe->Text(-width=>'20', -wrap => 'none' )-> pack(-expand=> 1, -fill=> 'both'); $xscrollleft= $middleframe->Scrollbar(-orient=>'horizontal')->pack(-fi +ll => 'x',-side=>'left',-expand=> 1,); $xscrollright= $middleframe->Scrollbar(-orient=>'horizontal')->pack(-f +ill => 'x',-side=>'right',-expand=> 1,); # Connect scrollbars to text widgets... $yscroll->configure( -command => [ \&scroll_both, $yscroll, [$text,$text2]]); $text->configure( -yscrollcommand => [ 'set', $yscroll]); $text2->configure( -yscrollcommand => [ 'set', $yscroll]); $text2->configure( -xscrollcommand => [ 'set', $xscrollright]); $text->configure( -xscrollcommand => [ 'set', $xscrollleft]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(bbfu) Re: Tricky Perl Tk scrollbars
by bbfu (Curate) on Nov 23, 2002 at 23:37 UTC |