use strict; use warnings; use Tk; use Tk::Table; our $MW = MainWindow->new(%{$BPP::BPPDEFAULTS::MYDEFAULTS{MAINWINDOW}}); $MW->geometry('800x700+0+0'); my $tableframe = $MW->Frame(-background=>'white' )->pack(-side=>'top', -fill=>'both', -pady=>20); my $bill_table = $tableframe->Table(-rows=>2, -columns=>3, -background=>'pink', -scrollbars=>'e' )->pack(-fill=>'both', -side=>'top', -anchor=>'s'); my @foo = qw/ Apple Oranges Pears/; my $x = 1; my $t=0; my $checkbox; my @checkboxvalue; foreach my $f (@foo) { $checkbox = $bill_table->Checkbutton(-variable=>\$checkboxvalue[$t]); $bill_table->put($x,0, $checkbox); $bill_table->put($x,1, $f); $bill_table->Button(-text=>'Submit', -command=>sub{if ($checkboxvalue[$t] ==1){print $f}} )->pack; $x++; $t++; }#end foreach loop MainLoop;