my $t1 = $top->Label(-text=>"$host",-background => "$color")->pack();
Rather than repeatedly creating and pack-ing a new Label widget into its parent as is now done, try re-configuring the options of an existing widget with configure (see discussion of this method in Tk::options):
$label_widget->configure(-text => $new_text, -background => $new_color);
(Again, this assumes the label widget has already been created and packed somewhere else in the code.)
BTW: It's not necessary to interpolate a scalar into a string (e.g., "$host" in the OPed code) in order to use it as a string.
Also BTW: I share your liking for Tk, all the more since I have some hard-won experience with it. But, sadly, it seems possible it may have become an orphan application. See various discussions on PerlMonks of Tk vis-a-vis Gtk2 and Wx.
In reply to Re: TK refresh widgit data
by AnomalousMonk
in thread TK refresh widgit data
by siffland
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |