thimes has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem with using a hash reference and updating a Label in PerlTk. It has to be something simple I am missing so I need some more eyes on the problem. This is a test program of a much larger one. Any help would be great! </p?
use Tk; require Tk::Entry; require Tk::Button; my $mw = MainWindow->new(); my %work = ( "VM-1" => "da923", "VM-2" => "dz427"); main_display(\%work); MainLoop; # ----------------------------------------------------- sub main_display { my $ref_hash = shift(@_); my $lab1 = $mw->Label(-textvariable => \$ref_hash{'VM-1'}, -relief => 'sunken', -width => 10, )->pack(); my $lab2 = $mw->Label(-textvariable => \$ref_hash{'VM-2'}, -relief => 'sunken', -width => 10, )->pack(); my $but = $mw->Button(-text=>'clear', -command=> [sub{ $ref_hash = {}; $mw -> update; }] )->pack(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Tk label references
by Anonymous Monk on Nov 10, 2016 at 21:29 UTC | |
by thimes (Acolyte) on Nov 10, 2016 at 21:40 UTC | |
by thimes (Acolyte) on Nov 10, 2016 at 22:07 UTC | |
by pryrt (Abbot) on Nov 10, 2016 at 22:17 UTC | |
by pryrt (Abbot) on Nov 10, 2016 at 22:20 UTC | |
| |
by Marshall (Canon) on Nov 10, 2016 at 22:52 UTC | |
by Anonymous Monk on Nov 10, 2016 at 22:44 UTC |