in reply to Perl/Tk and the "-variable => \$var" option
#!/usr/bin/perl use warnings; use strict; use Tk; my %svals =( 1 =>{ 'object' => undef, 'value' => 0, }, 2 =>{ 'object' => undef, 'value' => 0, }, 3 =>{ 'object' => undef, 'value' => 0, }, 4 =>{ 'object' => undef, 'value' => 0, }, ); # window setup my $mw = MainWindow->new; foreach my $i (1 .. 4) { $svals{$i}{'object'} = $mw->Scale( -from => 30, -to => 0, -orient => 'vertical', -variable => \$svals{$i}{'value'}, )->pack(-side => 'left'); } foreach my $i (1 .. 4) { $svals{$i}{'value'} = 7*$i; } MainLoop;
|
|---|