use strict;
use warnings;
use Tk;
my $mw =
tkinit ();
my $frame = $mw-> Frame (-relief => 'groove', -bd => 2)-> pack ();
my $text = $mw-> Text ()->pack (-expand => 1);
my $widget =
$frame-> Label (
-text => "Hier ist ein Widget!",
)->pack;
my $widget_on = 1;
my $button =
$mw-> Button (
-text => "Widget an/ausschalten",
-command => sub {
if ($widget_on == 0){
$frame-> pack (-before => $text);
$widget_on = 1;
}
else{
$frame-> packForget ();
$widget_on = 0;
}
}
)-> pack;
Tk::MainLoop ();