in reply to Perl/tk : Add checkbox button inside a frame

Here is a more general purpose example. If you don't know how big your array is, you are better off putting it into a Scrolled Pane, so your Frame dosn't get bigger than your screen size.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my @List = (0..50); my @cbvalue; my @cbs; my $mw = tkinit; $mw->geometry("200x200+100+100"); $mw->fontCreate('big', -weight=>'bold', -size=> 14 ); my $button = $mw->Button(-text => 'show selected', -command => \&show_selected, -bg => 'yellow', -font => 'big', )->pack(); my $pane = $mw->Scrolled('Pane', -bg => 'white', -scrollbars => 'osoe')->pack(-expand => 1, -fill => 'both'); foreach my $i ( 0 .. $#List ) { $cbs[$i] = $pane->Checkbutton( -text => "Number $List[$i]", -onvalue => 1, -offvalue => 0, -variable => \$cbvalue[$i], -font => 'big', -bg => 'lightseagreen', )->pack(); $cbvalue[$i] = 0; #initialize selections to off } MainLoop; sub show_selected { my @selected; foreach my $i ( 0 .. $#List ) { if ($cbvalue[$i] == 1){push @selected, $i} } print "selected: @selected\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh