Hello toolic,
Yes, I can reproduce this exactly. And from playing around with it, I found the following, which seems to work correctly:
#! perl use strict; use warnings; 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 => 3, -columns => 5)->pack; upd_table(); $but1->Button ( -text => 'update', -command => sub { upd_table() }, )->pack(); MainLoop(); exit; sub upd_table { $table->clear() if $table; for my $row (0 .. 2) { for my $col (0 .. 4) { my $x = int rand 10; my $cell = $table->Entry(-width => 4, -text => $x); $table->put($row, $col, $cell); } } }
That is, I just moved the line
$table = $lower->Table(-rows => 3, -columns => 5)->pack;
from the subroutine to the main code. No idea why this works, though. :-O
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Tk::Table clear creates unwanted boxes
by Athanasius
in thread Tk::Table clear creates unwanted boxes
by toolic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |