Thanks for giving replay, here is my code , in that two option menus , one button is there , what i want is , if the first optionmenu selected the second one get activated , if the second one get selected the exit button should get activated till then optionmenu2,exit button are disabled state how i do it please help me..........

#!/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'); } }

In reply to Re^4: How to disable the buttons by vr786
in thread How to disable the buttons by vr786

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.