in reply to help using packForget()
In addition to the technique of making $boom a global, you can also pass it to the subs, like this:
sub my_die { my $boom = MainWindow->new( -background => 'green' ); my $label = $boom->Label(); my $yes = $boom->Button(); my $no = $boom->Button(); $label->configure( -text => 'DO you really want to quit?' ); $yes->configure( -text => 'Yes', -command => [\&des,$boom] ); $no->configure( -text => 'NO', -command => [\&goback,$boom] ); $label->pack(); $yes->pack(); $no->pack(); } sub goback { my $boom = shift; $boom->packForget(); } sub des { my $boom = shift; $boom->packForget(); }
|
|---|