Two different solutions:
  1. pack/grid hybrid: Use pack to position Pane and Label, and give pack the options to dynamically resize Pane. Use grid to position buttons within Pane.
    Oops, kvale beat me to this one.
  2. pack only: Put each set of 4 radiobuttons in a Frame, and pack the frames into Pane.
Other general recommendations: The code below demonstrates all the recommendations, and both solutions.
#!/usr/bin/perl -w use strict; use Tk; use Tk::Pane; # Set to 0 or 1 before running. my $grid_method = 1; my $mw = MainWindow->new( -title => "SACL Survey" ); my $pane = $mw->Scrolled(qw/Pane -scrollbars osow/)->pack( -expand => 'yes', -fill => 'both', ); $mw->Label( -text => "... <insert directions here> ..." )->pack(); my @button_values; if ($grid_method) { foreach my $j (1..4) { $pane->Label( -text => $j, )->grid( -column => $j, -row => 1, ); } foreach my $i (1..30) { foreach my $j (1..4) { $pane->Radiobutton( -value => $j, -variable => \$button_values[$i-1], )->grid( -column => $j, -row => $i+1, ); } } } else { foreach my $i (1..30) { my $frame = $pane->Frame->pack(); foreach my $j (1..4) { $frame->Radiobutton( -text => $j, -value => $j, -variable => \$button_values[$i-1], )->pack( -side => 'left', ); } } } MainLoop; use Data::Dumper; print Dumper \@button_values;

In reply to Re: Some beginning Tk help by Util
in thread Some beginning Tk help by dimmesdale

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.