I just started learning Perl/Tk today, and doing an example encountered a problem. (I'm using Mastering Perl/Tk, an O'reilly book, but it doesn't seem to address this)

I need to have 30 groups of 4 radio buttons (with values 1, 2, 3, and 4, respectively). This, however, takes up more than a screen, so I needed to use a scroll bar. The main window, for some reason, cannot have a scroll bar (that I can figure out, anyway), so I'm using the PaneWidget.

I tried using the pack geometry manager, however it was a MESS! I couldn't control the output. I realized, though, that the grid manager would be just what I required (to make each group of four on a separate line {or in this case, row}).

And herein lies the problem. . . (sorry for the long intro, but it kind of sets the context)

I CAN'T GET THE FRAME (the pane widget) TO OCUPY THE WHOLE WINDOW. That is, when I enlarge the window, the frame is still in a tiny portion in the middle. Using pack, I did the fill option to try to take care of it, and it worked, but I don't know what to do with grid. PLEASE HELP.

The code is here. (p.s., I tried columnspan, rowspan, but it didn't seem to have any success)

#!/usr/bin/perl use lib 'C:\MyPerlLib'; use Tk; my $i = 0; my $mw = MainWindow->new( -title => "SACL Survey" ); my $pane = $mw->Scrolled(qw/Pane -scrollbars osw/)->grid(); $mw->Label( -text => "... <insert directions here> ..." )->grid(); for (1..30) { $pane->Radiobutton( -text => "1", -value => "1", -justify => "left", -variable => \${"rb1_q$_"}, )->grid( $pane->Radiobutton( -text => "2", -value => "2", -justify => "left", -variable => \${"rb2_q$_"}, ), $pane->Radiobutton( -text => "3", -value => "3", -justify => "left", -variable => \${"rb3_q$_"}, ), $pane->Radiobutton( -text => "4", -value => "4", -justify => "left", -variable => \${"rb4_q$_"}, )); } MainLoop;

In reply to 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.