michael99 has asked for the wisdom of the Perl Monks concerning the following question:
I am using tk module to build a checklist for user to choose. I am totally beginner to this module. Currently the checklist created is all in the same series column, since it will be a long list, any idea how could I separate few of the options to another column? Also, any idea how to align those text to the left while checkbox to the right? To display it cleanly and neatly.
#!/usr/bin/perl use Tk; $main = MainWindow->new(); $label = $main->Label(-text => "Presence Check"); $label->pack(); $frame = $main->Frame(-relief=>"groove", -borderwidth=>2); #$frame = $main->Frame(-relief=>"groove", -borderwidth=>2)->pack(-side + => 'top', -expand => 1, -fill =>'both'); #$frame = $main->Frame->pack(-side => 'left', -fill => 'x'); $check1 = $frame->Checkbutton(-text=>"Document A (docx, pdf)", -variable=>\$a, -onvalue=>"APRESENT", -offvalue=>"AABSENT"); #$check1->pack(-side=>"top"); $check2 = $frame->Checkbutton(-text=>"Document B (xlsx)", -variable=>\$b, -onvalue=>"BPRESENT", -offvalue=>"BABSENT"); $check2->pack(-side=>"top"); $check3 = $frame->Checkbutton(-text=>"C specification", -variable=>\$c, -onvalue=>"CPRESENT", -offvalue=>"CABSENT"); $check3->pack(-side=>"top"); $check4 = $frame->Checkbutton(-text=>"A-Specification", -variable=>\$aspec, -onvalue=>"ASPECPRESENT", -offvalue=>"ASPECSABSENT"); $check4->pack(-side=>"top"); $check5 = $frame->Checkbutton(-text=>"Important Report", -variable=>\$report, -onvalue=>"REPORTPRESENT", -offvalue=>"REPORTSABSENT"); $check5->pack(-side=>"top"); $check6 = $frame->Checkbutton(-text=>"Handbook", -variable=>\$handbook, -onvalue=>"HANDBOOKPRESENT", -offvalue=>"HANDBOOKABSENT"); $check6->pack(-side=>"top"); $check7 = $frame->Checkbutton(-text=>"Data Spreadsheet", -variable=>\$dataxls, -onvalue=>"DATAPRESENT", -offvalue=>"DATAABSENT"); $check7->pack(-side=>"top"); $check8 = $frame->Checkbutton(-text=>"D file", -variable=>\$dfile, -onvalue=>"DFILEPRESENT", -offvalue=>"DFILEABSENT"); $check8->pack(-side=>"top"); $check10 = $frame->Checkbutton(-text=>"xx doc", -variable=>\$xxdoc, -onvalue=>"XXDOCPRESENT", -offvalue=>"XXDOCABSENT"); $check10->pack(-side=>"top"); $check18 = $frame->Checkbutton(-text=>"yy Doc", -variable=>\$yydoc, -onvalue=>"YYDOCPRESENT", -offvalue=>"YYDOCABSENT"); $check18->pack(-side=>"top"); $frame->pack(); $button = $main->Button(-text => "Exit", -command => \&exit_button); $button->pack(); MainLoop(); sub exit_button { print "$a $b $c $aspec $report $handbook $dataxls $dfile $xxdoc $yydoc + \n"; #print "$rv\n"; exit, }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PERL tk module handling
by stefbv (Priest) on Apr 19, 2020 at 10:10 UTC | |
|
Re: PERL tk module handling
by kcott (Archbishop) on Apr 19, 2020 at 12:56 UTC | |
|
Re: PERL tk module handling
by AnomalousMonk (Archbishop) on Apr 19, 2020 at 13:36 UTC | |
|
Re: PERL tk module handling
by tybalt89 (Monsignor) on Apr 19, 2020 at 17:23 UTC | |
|
Re: PERL tk module handling (Tk::CheckbuttonGroup)
by Anonymous Monk on Apr 19, 2020 at 10:14 UTC |