Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Do you perhaps know of an easy way to store/remember the pack arguments for each widget?

Make it a widget (read object)

my $rememberer = MakeHideDaddyChildButton( -buttonDaddy => $top_frame, -hidersDaddy => $mw, # gets resized -hiders => [ $top_frame, $middle_frame ], #daddys kiddys ); $rememberer->pack;

This does leave the problem that after a resize, the 'hide' action does not minimize the container frame. Any idea how to get that fixed?

Um, repack the container frame (or its parent, or mainwindow ) .... or better idea, only ever forget/repack the container frame

Might need to resize (->geometry)

I'd have posted an example, but I was already working on this one, keep shooting, and watch the canvas resize :) the mainwindow doesn't resize

#!/usr/bin/perl -- use strict; use warnings; use Tk; my $packArgs = do { my @packargs = ( [ qw/-expand 0 / ], [ qw/-expand 1 -fill x / ], [ qw/-expand 1 -fill y / ], [ qw/-expand 1 -fill both / ], ); my $ix = -1; my $xx = @packargs ; sub { $ix++; warn $ix % $xx ; return @{ $packargs[ $ix % $xx ] }; }; }; my $mw = tkinit; $mw->Button( -text => 'BANG!', -command => \&bangBang )->pack(qw/-side top -anchor n/); my $ca = $mw->Canvas( background => 'white' ) ->pack( $packArgs->() ); $ca->createOval( 50, 50, 100, 100, -fill => 'pink', ); MainLoop; exit 0; sub bangBang { my $b = $Tk::event->W; $mw->Busy; $b->configure(-state => "disabled"); my $text = $b->cget(qw/ -text /); unless( $text =~ s/(\d+)/ $1 + 1 /e ){ $text .= " 1"; } $b->configure( -text => $text); $ca->packForget; $mw->update; sleep 1; $ca->pack( $packArgs->() ); $mw->Unbusy; $b->configure(-state => "normal"); $mw->update; }

In reply to Re^3: resizing problem with Tk appl using PackForget by Anonymous Monk
in thread resizing problem with Tk appl using PackForget by monger_39

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2022-11-29 12:18 GMT
Find Nodes?
    Voting Booth?