And here's an example of making a fixed number of Labels and changing the data in each with a scrollbar.
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Pane; my $offset = 0; my $labelcount = 7; my $mw = MainWindow->new(); $mw->geometry('500x500'); my $pane = $mw->Scrolled( 'Pane', -scrollbars => 'se' )->pack( -side = +> 'left', -fill => 'both', -expand => 1 ); my @data = map "Col $_", 1 .. 1000; $pane->Scale(-orient => 'horizontal', -from => 0, -to => @data - $labelcount, -variable => \$offset, -command => \&sho +w, -showvalue => 0, )->pack(-fill => 'x', -side => 'bottom'); my @labels = map { $pane->Label( -text => $data[$_], -relief => 'groove', -height => 20, -width => 8, )->pack( -side => 'left' ); } 0 .. $labelcount - 1; MainLoop; sub show { my $i = $offset; for ( @labels ) { $_->configure( -text => $data[$i++] ); } }
In reply to Re^3: Tk::Pane widget size limit?
by tybalt89
in thread Tk::Pane widget size limit?
by jbuck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |