hi all, i want to create an array of buttons and handle them when clicked. in my code the last button in the array is handled even if any other button is clicked. pls help. thanks
my @buttons; for my $i(0..5){ push @buttons, $mw->Button(-text => $i, -command => sub{ print "pressed $i\n"; # or use the widget: print "pressed ", $buttons[$i]->cget('-text'), "\n"; })->pack; }
In reply to Array of buttons by GayathriBalu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |