in reply to Perl Tk Forgetting a Widget

Using a simple example of an exit callback:
#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new; fill_window($mw, 'Main'); my $top1 = $mw->Frame; fill_window($top1, 'First Frame'); my $tx = $mw->Scrolled('Text', -font => 'normal', -width => '73', -height => '15', -wrap => 'word', -scrollbars => 'e'); $tx->pack; tie *STDOUT, 'Tk::Text', $tx; MainLoop; sub fill_window{ my ($window, $header) = @_; $window->Label(-text => $header)->pack; $window->Button( '-text' => 'forget', '-command' => [$mw => 'destroy'] )->pack('-side' => 'right'); }