#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Table; my $cols = 6; my $rows = 10; # create the main window and frame my $mw = new MainWindow(); my $frame = $mw->Frame()->pack; my $table = $frame->Table( -columns => $cols, -rows => $rows + 1, -fixedrows => 1, -scrollbars => 'oe', -relief => 'raised', ); # column headings for my $c(1 .. $cols){ my $tmp = $table->Label(-text => 'Row '.$c, -width => 6, -relief => 'raised', ); $table->put(0,$c,$tmp); } # populate the cells and bind an action to each one for my $r(1 .. $rows){ for my $c(1 .. $cols){ my $tmp = $table->Label( -text => $r.','.$c, -padx => 2, -anchor => 'w', -background => 'white', -relief => 'groove', ); $table->put($r,$c,$tmp); } } $table->pack(-expand => 'yes',-fill => 'both'); MainLoop();