#!/usr/bin/perl use Tk; use Tk::TableMatrix; use strict; use warnings; my $mw = MainWindow->new; my $table = $mw->Scrolled("TableMatrix", -resizeborders=>'none', -titlecols => 1, -rows => 6, -colstretchmode=>'all', -cols => 1, -cache => 1, -scrollbars => "osoe"); for(my $col = 1; $col < 500; $col++) { $table->insertCols("$col.0", 1); my $button = $table->Button(-text => "$col enabled", -command => sub {$table->see("0,300"); } ); #initialy fill table with blank windows. Section to improve my $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("0,$col", -window => $blank, -sticky => 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("1,$col", -window => $blank, -sticky => 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("2,$col", -window => $blank, -sticky => 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("3,$col", -window => $blank, -sticky => 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("4,$col", -window => $blank, -sticky => 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -cursor => ['left_ptr']); $table->windowConfigure("5,$col", -window => $blank, -sticky => 'nsew'); #fill each column with a button with random row placement my $row = int(rand(5)); $table->windowConfigure("$row,$col", -window => $button, -sticky => 'nsew'); } #set row titles $table->set("0,0", "Col 1"); $table->set("1,0", "Col 2"); $table->set("2,0", "Col 3"); $table->set("3,0", "Col 4"); $table->set("4,0", "Col 5"); $table->set("5,0", "Col 6"); $table->pack(-expand => 1, -fill => 'both'); MainLoop;