in reply to Re^3: Code after MainLoop; Tk
in thread Code after MainLoop; Tk

As I have recently gotten a new PC at work, I have not yet installed all of the various tools I use, so I don't have Tk handy to try your code. However...

In your check_sub subroutine, at the time of this reply, all of your checks will be listed. Are the values of $check1 though $check16 what you expected?

I did notice that you have:

-offvalue => 'NOT CHECKED')->pack(), -command => print OUTFILE "$job8\n";

It should be:

-offvalue => 'NOT CHECKED', -command => print OUTFILE "$job8\n")->pack();

Also, you could use arrays in your code. Something like (not tested):

my @jobs = qw( 18L 07O and so on ); my @checks = ('NOT CHECKED') x @jobs; my @buttons; my $i = 0; for (@jobs) { my $buttons[$i] = $check_frame->Checkbutton ( -text => $_, -variable => \$checks[$i], -onvalue => ' ADDED', -offvalue => 'NOT CHECKED', -command => print OUTFILE "$jobs[$i]\n" )->pack(); $i++; }

Replies are listed 'Best First'.
Re^5: Code after MainLoop; Tk
by PerlCowboy (Novice) on Jun 15, 2016 at 17:09 UTC
    Ron, with your help and Soonix, my code is now fully fundtional. The command line was changed to: -command => sub {print OUTFILE "$job17\n"})->pack();

    This got the effect I was looking for in that only the checked items are sent accross to the spreadsheet. Thanks!