...here is an example for you to check out

... the problem is how do you detect the end of playback... is some signal emitted?

.... i leave the state logic broken, for you to figure out :-)

#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = Tk::MainWindow->new; my $button = $mw->Button->pack(-side =>'left'); my $button1 = $mw->Button(-text => 'Go ', -state => 'normal')->pack( -side =>'left'); my $x = $mw->Pixmap( -data => qq(/* XPM */ static char * x_xpm[] = { "24 24 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " ", " ... ... ", " .. .. ", " ... .. ", " .. ... ", " .... ", " ... ", " ... ", " .... ", " .. .. ", " ... .. ", " .. ... ", " .. .. ", " ... ... ", " ", " ", " ", " ", " "}; )); my $o = $mw->Pixmap( -data => qq(/* XPM */ static char * o_xpm[] = { "24 24 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " ", " ...... ", " ........ ", " ... ... ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " ... ... ", " ........ ", " ...... ", " ", " ", " ", " ", " "}; )); my @toggle = ($x, $o); my @toggle1 = ('Go ','Whoa'); $button->configure( -image => $x, -command => sub { @toggle = @toggle[1, 0]; @toggle1 = @toggle1[1, 0]; $button->configure(-image => $toggle[0]); if ( $toggle1[0] eq 'Go '){ $button1->configure( -text => $toggle1[0], -state => 'normal', ); }else{ $button1->configure( -text => $toggle1[1], -state => 'disabled', ); } } ); Tk->MainLoop;

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

In reply to Re: Dynamically altering Tk buttons by zentara
in thread Dynamically altering Tk buttons by Llew_Llaw_Gyffes

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.