Okay, let me start over and try again. My previous reply was totally irrelevant (though I do like the cleaner technique, which I hope is helpful in its own right).

I managed to get consistent and (presumably close to) intended resizing results by changing this:

$wjLabEntry->destroy; $mode_buttons->destroy; $wjLabEntry = $mw->Frame(-bg => "wheat1")->pack(); $mode_buttons = $mw->Frame(-bg => "wheat1")->pack();
to this:
$_->destroy for ( $wjLabEntry->children ); $_->destroy for ( $mode_buttons->children );
That might not end up doing exactly what you want, but at least the window remains large enough to be usable and in fact gets bigger as needed. And at least it makes a certain amount of sense: Tk's pack manager will work better if the containing frames remain intact, as opposed to being destroyed and rebuilt from scratch.

Apart from that, if you pass those two frame widget handles as params to "do_setup" when calling it from get_job, you would be able to add "use strict" without any additional global variables, which would be a Good Thing.

And you can drop all the use Tk::*; lines -- just use Tk; will suffice. Ditto for all the  $mw->update calls (those just aren't needed in this situation).

FINAL UPDATE: I'm guessing that the unpredictable behavior I was seeing with the OP code is probably related to the relatively recent Perl 5 feature that enhanced the security of hash key management -- this feature may have been missing in the ancient Solaris environment that the OP code came from, and in that old environment the code was probably always working because the Tk internal hashes were always being stored (and accessed/destroyed) in a consistent order. That consistency goes away in current Perl versions, which could mean that from one run to the next, calling "destroy" on the two frames that make up your entire MainWindow might cause variable results, depending on what gets destroyed first... But that's just a guess.

Anyway, I also noticed that since you don't seem to use the "$wjLabEntry" frame ever again, you can destroy that one, and just keep the "$mode_buttons" frame (destroying its children only). That would probably result in the appearance that you really want.


In reply to Re: Problems after upgrading both Perl and Tk by graff
in thread Problems after upgrading both Perl and Tk by monksp

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.