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!", ); my $widget_2 = $frame-> Frame ( -height => 0, )-> pack; my $widget_on = 1; my $button = $mw-> Button ( -text => "Widget an/ausschalten", -command => sub { if ($widget_on == 0){ $widget-> pack (); $widget_on = 1; } else{ $widget-> packForget (); $widget_on = 0; } } )-> pack; Tk::MainLoop ();