If $run_all_button->flash() dosn't work, you can make one manually with a timer. See second script below. I'm guessing it flashes once, and so fast you miss it. You may need to add a timer.

As to your button states, look at this script.

#!/usr/bin/perl use Tk; $mw = MainWindow->new(-title => "Testing Stop Button\n"); my $toolbar = $mw->Frame->pack(-side => 'left'); $button_run = $toolbar->Button(-text => "RUN", -command => sub{ $mw->Busy(-recurse => 1, -cursor => 'watch'); $button_run->configure(-state => 'disabled'); $button_stop->configure(-state => 'normal');}) ->pack(-side => 'left'); $button_stop = $toolbar->Button(-text => "STOP", -command => sub{ print "sub called, not Click_stop\n"; $stop_spyglass = 1; $button_stop->configure(-state => 'disabled');}, -state => 'disabled') ->pack(-side => 'left'); $button_stop->bind( '<Leave>', \&Leave_stop); $button_stop->bind('<Enter>', \&Enter_stop); $button_stop->bind('<Button-1>', \&Click_stop); sub Enter_stop { print "Enter_stop ", $button_stop->cget('-state'), "\n"; if ($button_stop->cget('-state') eq 'active' ){ $mw->Unbusy(); } } sub Leave_stop { print "Leave_stop ", $button_stop->cget('-state'), "\n"; if ($button_stop->cget('-state') eq 'normal'){ $mw->Busy(-recurse => -1, -cursor => 'watch'); } } sub Click_stop{ print "Click_stop ", $button_stop->cget('-state'), "\n"; if ($button_stop->cget('-state') eq ('active')){ $stop_spyglass = 1; $button_stop->configure(-state => 'disabled'); $button_run->configure(-state => 'normal'); } } MainLoop;
and a button flasher
#!/usr/bin/perl use Tk; use strict; my $mw = tkinit; my $button = $mw->Button(-text => 'Push Me')->pack; $button->configure(-command => [\&Invert, $button]); my $button1 = $mw->Button(-text => 'Flashy')->pack; my $timer = $mw->repeat(500,[\&Invert, $button1]); MainLoop; sub Invert { my($w) = @_; $w->configure(-bg => $w->cget('-fg'), -fg => $w->cget('-bg')); }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: How to freeze a button while it is in active mode by zentara
in thread How to freeze a button while it is in active mode by Janish

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.