mikasue has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to unpack a frame that was packed in a toplevel window? I have the need to replace a frame in a TK app. Can this be done?

Replies are listed 'Best First'.
Re: Perl/TK Unpacking?
by zentara (Cardinal) on Jul 18, 2006 at 17:17 UTC
    $frame->packForget

    But watch out for memory gains if you place new frames in there. packForget dosn't destroy the widget, it just removes it from view. So reuse your frames and widgets.... by packForget'ing them, reconfiguring them in the withdrawn state, then repacking them. There are some details to work on, like unwanted resizing occurring, so you may need to repack the entire window. YMMV

    #!/usr/bin/perl use warnings; use strict; use Tk; my $top = new MainWindow; my $txt = $top->Scrolled("Text")->pack; $top->Button(-text => "packForget", -command => sub{ my @w = $top->packSlaves; foreach (@w) { $_->packForget; } })->pack(); $top->Button(-text => "Exit", -command => sub {exit})->pack; MainLoop; __END__

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      Thanks for the reply. Thanks also for the warnings...