#!/usr/bin/perl -w use Tk; my $mw = MainWindow->new(); $mw-> geometry("400x100"); $mw -> configure(-background => "cyan", -foreground => "lightblue" ); my $opt = "0"; my $opt1 = "0"; my ($var, $tvar); $opt = $mw->Optionmenu( -background => "lightgreen", -options => [[jan=>1], [feb=>2], [mar=>3], [apr=>4]], -command => sub { print "got: ", shift, "\n" }, -variable => \$var, -textvariable => \$tvar )->pack; $opt->configure(-state); #$opt->configure(-state=>'disabled'); $opt->addOptions([may=>5],[jun=>6],[jul=>7],[aug=>8]); my $exit_but = $mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack(-side=>"bottom"); $exit_but->configure(-state); $exit_but->configure(-state => 'disabled'); $opt1 = $mw->Optionmenu( -background => "lightgreen", -options => [qw(test1 test2 test3)], -command => \&do_some, -variable => \$var, )->pack; $opt1->configure(-state); MainLoop; sub do_some { if($opt ) { $exit_but -> configure(-state => 'disabled'); } else { $opt->configure(-state=>'disabled'); $opt1->configure(-state=>'active'); } }