in reply to OO novice with Perl/Tk

I'm not quite clear what you're trying to do. Is the widget you are trying to destroy the toplevel window itself? If it's the MainWindow for your application then this always exits.

For non-toplevel widgets you should just be able to use $widget->destroy().

Kevin O'Rourke

Replies are listed 'Best First'.
Re: Re: OO novice with Perl/Tk
by Merrick (Initiate) on Jun 26, 2001 at 15:12 UTC
    That did the trick. I'm learning from the O'Reilly Perl Bookshelf series. They never make this clear in the gui building chapters. Thanks! Merrick
    use Tk; choice(); # After the widget vanishes # the program continues here ... print "Success!!\n"; sub choice{ $top = MainWindow -> new(); $frame = $top -> Frame() -> pack(); $button = $frame->Button (-text => 'Kill', -command => sub{$top -> destroy()} )->pack(); MainLoop; }