#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $mw = tkinit; my $spane = $mw->Scrolled('Pane', -scrollbars => 'osoe', -bg => 'blue', )->pack(-expand => 1, -fill => 'both'); # create 2 frames side by side in the pane, and fill with more frames my $lframe = $spane->Frame(-bg=>'red')->pack(-side=>'left',-padx=>3); my $rframe = $spane->Frame(-bg=>'red')->pack(-side=>'right',-padx=>3); my %frames; for(1..100){ $frames{$_}{'frame'} = $lframe->Frame()->pack(-pady => 5 ); $frames{$_}{'label'} = $frames{$_}{'frame'}->Label(-text=>'Frame '.$_)->pack; my $num = $_; $frames{$_}{'button'} = $frames{$_}{'frame'}->Button( -text=>'Button '.$_, -command => sub{print "$num pressed\n"}, )->pack; } for(101..200){ $frames{$_}{'frame'} = $rframe->Frame()->pack(-pady => 5 ); $frames{$_}{'label'} = $frames{$_}{'frame'}->Label(-text=>'Frame '.$_)->pack; my $num = $_; $frames{$_}{'button'} = $frames{$_}{'frame'}->Button( -text=>'Button '.$_, -command => sub{print "$num pressed\n"}, )->pack; } MainLoop;