Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Aligning Tk Checkboxes

by protist (Monk)
on Sep 13, 2012 at 02:26 UTC ( #993348=note: print w/ replies, xml ) Need Help??


in reply to Aligning Tk Checkboxes

I'm guessing your checkboxes end up something like 1 1 --- 2 2 --- 3 3 --- 4 4 (dashes denote frame separation) If you want them to be aligned with any amount of text, you should use + two frames as follows: 1 | 1 2 | 2 3 | 3 4 | 4 This is using two frames each packed to the left. One frame contains the first check box for sets 1-4, the other contains the second check box for sets 1-4.


Comment on Re: Aligning Tk Checkboxes
Download Code
Replies are listed 'Best First'.
Re^2: Aligning Tk Checkboxes
by kcott (Abbot) on Sep 13, 2012 at 03:13 UTC

    G'day protist,

    On the basis of your textual description, that will produce the same dog's hind leg alignment that I described below.

    Perhaps you could post some code to clarify - maybe I've misunderstood your intent.

    -- Ken

      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.

        That is indeed what I meant :)

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

        -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2015-07-29 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls