Knowledgeable monks,
I am using 'grid' to display various widgets within a Tk toplevel widget. 'grid' lets me conceive of my widgets as buttons laid out on a spreadsheet, and indeed I use a spreadsheet to design the layout in the first place.

My problem: When I use the coordinates from my rows and columns as they appear on the spreadsheet, Tk seems to ignore all the "padding" I am trying to build in for my widget. It seems to collapse the widget's size, showing only the amount necessary to display the text label of the widget. Ideally, layout would appear exactly as on my spreadsheet, with all my row and column sizings using uniform units of space. For example, I display a button via the following:

$Output_b->grid( -column => 5, -row => 10, -columnspan => 4, -rowspan => 6, -sticky => 'nsew', );

but the output doesn't look at all like a 4x6 button. I'm considering putting empty widgets on rows 10 - 15 to make grid willing to span the six rows, but that doesn't seem like the proper way.

After this 'grid' section I have:

my ($cols, $rows) = $tl->gridSize(); for (my $i = 0; $i < $cols; $i++) { $tl->gridColumnconfigure($i, -weight => 1); } for (my $i = 0; $i < $rows; $i++) { $tl->gridRowconfigure($i, -weight => 1); }

which I thought would solve my problem but I can't tell as this does much. One of the button's text is not clipped and the buttons seem a little more uniform in the height of their rows, but....


In reply to Want Tk to fully display 4x6 widget w/ grid instead of collapsing it by ff

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.