Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks zentara. The Tk::CheckbuttonGroup module works great! It looks like the synopsis code was missing "pack". Unfortunately, I just found out I'm not going to be able to install additional CPAN modules at deployment sites (sigh), so (taking a cue from the module) I re-worked the frames in my original code to display two vertically aligned columns of checkboxes using only Tk (see new code below). Thanks for all your help.

#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new(); $mw->geometry('360x250+280+60'); $mw->bind('<Escape>' => sub {exit;}); $mw->configure(-title => 'Test Checkbox Alignment'); my ($qv, $dg, $yb, $pv, $rd, $oc, $hr, $tm); ################################################################### # Create buffer 1. ################################################################### my $buffer1 = $mw->Frame; $buffer1->pack(-side => 'left', -padx => 25); ################################################################### # Create frame 1. ################################################################### my $frame1 = $mw->Frame; $frame1->pack(-side => 'left'); ################################################################### # Create check box 1 for frame 1. ################################################################### my $qv_cbox = $frame1->Checkbutton( -text => 'QuickCheck', -variable => \$qv, ); $qv_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 2 for frame 1. ################################################################### my $dg_cbox = $frame1->Checkbutton( -text => 'Systems Guide', -variable => \$dg, ); $dg_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 3 for frame 1. ################################################################### my $yb_cbox = $frame1->Checkbutton( -text => 'Study', -variable => \$yb, ); $yb_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 4 for frame 1. ################################################################### my $pv_cbox = $frame1->Checkbutton( -text => 'Analyze', -variable => \$pv, ); $pv_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create buffer 2. ################################################################### my $buffer2 = $mw->Frame; $buffer2->pack(-side => 'left', -padx => 25); ################################################################### # Create frame 2. ################################################################### my $frame2 = $mw->Frame; $frame2->pack(-side => 'left'); ################################################################### # Create check box 1 for frame 2. ################################################################### my $rd_cbox = $frame2->Checkbutton( -text => 'Read', -variable => \$rd, ); $rd_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 2 for frame 2. ################################################################### my $oc_cbox = $frame2->Checkbutton( -text => 'Configure', -variable => \$oc, ); $oc_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 3 for frame 2. ################################################################### my $hr_cbox = $frame2->Checkbutton( -text => 'Troubleshoot', -variable => \$hr, ); $hr_cbox->pack( -side => 'top', -anchor => 'w', ); ################################################################### # Create check box 4 for frame 2. ################################################################### my $tm_cbox = $frame2->Checkbutton( -text => 'Prioritize', -variable => \$tm, ); $tm_cbox->pack( -side => 'top', -anchor => 'w', ); MainLoop; exit;

"Its not how hard you work, its how much you get done."


In reply to Re^4: Aligning Tk Checkboxes by roho
in thread Aligning Tk Checkboxes by roho

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found