use warnings; use strict; use Tk; use Tk::Table; my $mw = MainWindow->new(); my $upper = $mw->Frame()->pack(-side => 'top'); my $but1 = $upper->Frame()->pack(); my $lower = $mw->Frame()->pack(-side => 'bottom'); my $table = $lower->Table(-rows => 32, -columns => 5)->pack; upd_table(); $but1->Button( -text => 'update', -command => sub { upd_table() }, )->pack(); MainLoop(); exit; sub upd_table { $table->clear() if $table; my $r = 3 + int rand 3; foreach my $row ( 0 .. $r-1 ) { foreach my $col ( 0 .. 4 ) { my $x = int rand 10; my $cell = $table->Entry( -width => 4, -text => $x ); $table->put( $row, $col, $cell ); } } }