#!/usr/bin/perl -w use Tk; $top = MainWindow->new(); $top->maxsize(600,300); $NUMCOLS = 10; # Number of columns to display # Create a frame into which all the text boxes will go $frm = $top->Frame()->pack(); # Make and pack the scrollbar $scrollbar = $frm->Scrollbar()->pack(-side => 'left', -fill => 'y'); # Set up textboxes for ($i = 0; $i < $NUMCOLS; $i++) { $block[$i] = $frm->Text( -width => 20, -height => 30, -background => 'white', -yscrollcommand => ['set' => $scrollbar] ); for ($j = 0; $j < 100; $j++) { $block[$i]->insert('end',"$j\n"); } } ## Configure the scrollbar to scroll each textbox $scrollbar->configure(-command => sub { foreach $box (@block) { $box->yview(@_); }}); ## Pack the textboxes foreach $box (@block) { $box->pack(-side => 'left'); } MainLoop();