http://www.perlmonks.org?node_id=993406


in reply to Re^2: Aligning Tk Checkboxes
in thread Aligning Tk Checkboxes

Probably this is what he meant:
#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = new MainWindow; $mw->geometry("360x250+280+60"); $mw->bind('<Escape>' => sub { $mw->destroy }); $mw->configure(-title => 'Test Checkbox Alignment'); # Main frame my $mf = $mw->Frame->pack( -side => 'bottom', -pady => 1 ); # Inner frames my $frm_l = $mf->Frame->pack( -side => 'left', -pady => 1 ); my $frm_r = $mf->Frame->pack( -side => 'right', -pady => 1 ); my $qv; my $qv_cbox = $frm_l->Checkbutton( -text => 'QuickCheck', -variable => \$qv, )->pack( -anchor => 'w', ); my $dg; my $dg_cbox = $frm_l->Checkbutton( -text => 'Systems Guide', -variable => \$dg, )->pack( -anchor => 'w', ); my $yb; my $yb_cbox = $frm_l->Checkbutton( -text => 'Study', -variable => \$yb, )->pack( -anchor => 'w', ); my $pv; my $pv_cbox = $frm_l->Checkbutton( -text => 'Analyze', -variable => \$pv, )->pack( -anchor => 'w', ); # Create 2nd set of check boxes. my $rd; my $rd_cbox = $frm_r->Checkbutton( -text => 'Read', -variable => \$rd, )->pack( -anchor => 'w', ); my $oc; my $oc_cbox = $frm_r->Checkbutton( -text => 'Configure', -variable => \$oc, )->pack( -anchor => 'w', ); my $hr; my $hr_cbox = $frm_r->Checkbutton( -text => 'Troubleshoot', -variable => \$hr, )->pack( -anchor => 'w', ); my $tm; my $tm_cbox = $frm_r->Checkbutton( -text => 'Prioritize', -variable => \$tm, )->pack( -anchor => 'w', ); MainLoop;

Feel free to reorder the widgets how you need them to be.

Regards, Ştefan

P.S. It's also the way I would do the layout.

Replies are listed 'Best First'.
Re^4: Aligning Tk Checkboxes
by protist (Monk) on Sep 13, 2012 at 16:12 UTC
    That is indeed what I meant :)
Re^4: Aligning Tk Checkboxes
by kcott (Archbishop) on Sep 14, 2012 at 05:44 UTC

    ++stefbv. Thanks for the clarification. I did indeed misunderstand the intent from the textual description.

    -- Ken