if you would be kind enough to put the entire runnable code example into a single code block, i might be able to help you...... at first glance you mix grid and pack...... i don't think it is wise to mix layout managers

....as far as auto-resizing goes, resizing the mainwindow is usually a bad option..... what you should do, is pack your buttons in a Scrolled Pane, and let the scrolled pane adjust the size of the scroll region to accomodate extra buttons......or look at the following

#!/usr/bin/perl use strict; use Tk; my $mw = tkinit; my %cb; my $f = $mw->Frame->pack(-anchor => 'w'); foreach (qw/Author Reviewer File Status Mine/) { $cb{$_} = $f->Checkbutton(-text => $_)->pack(-anchor => 'w'); } my $on_off = 1; foreach (['Enable', 1], ['Disable', 0]) { $mw->Radiobutton( -text => $_->[0], -command => [\&ChangeAuthor, $_->[1]], -variable => \$on_off, -value => $_->[1], )->pack(-side => 'left'); } MainLoop; sub ChangeAuthor { if (shift) { $cb{Author}->pack(-before => $cb{Reviewer}, -anchor => 'w'); } else { $cb{Author}->packForget; } }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

In reply to Re^3: How to resize mainwindow automatically by zentara
in thread How to resize mainwindow automatically by ch123

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.