Maybe this will give you some useful hints.
use strict;
use warnings;
use Tk;
my %w; #widget hash
$w{mw} = MainWindow->new;
my $state = 'normal';
$w{fr} = $w{mw}->Frame()->pack(
-expand => '1',
-fill => 'x',
-side => 'top'
);
for ( 'normal', 'disabled', 'invisible' ) {
$w{fr}->Radiobutton(
-variable => \$state,
-value => $_,
-text => ucfirst $_,
-command => sub { change( $state, $w{fr2} ) }
)->pack( -side => 'left' );
}
$w{fr2} = $w{mw}->Frame()->pack(
-expand => '1',
-fill => 'both',
-side => 'top'
);
for ( 1 .. 10 ) {
$w{fr2}->Label( -text => "Label $_" )->grid( -row => $_, -column =
+> 0 );
$w{fr2}->Entry()->grid( -row => $_, -column => 1 );
}
MainLoop;
sub change {
my ( $state, $widget ) = @_;
if ( $state eq 'invisible' ) { $widget->packForget }
else {
$widget->pack;
$_->configure( -state => $state ) for $widget->children;
}
}