Yup, I found that method myself, after some digging.

How I'm detecting the end of playback is a little sneaky.  I'm spawning the CLI MP3 player application like this:

$cmd = sprintf($opts{playercmd}, ($listbox->getRow($i))[0]); $player_pid = open($PLAYER, "|$cmd");

This gets me a blocking open on the player, so that I don't ever get two tracks playing at once, and a child PID back.  But, the child player doesn't terminate on exit.  So then I poll /proc/pid/status every 50ms in my non-Tk event loop, and wait for the status to change to 'zombie', at which point I know playback has finished.  Then I can close the player handle, do any necessary processing, and advance to the next track.  The 50ms response time is too short for the listener to notice, but slow enough in system terms that the task load from the polling is down in the noise.


In reply to Re^2: Dynamically altering Tk buttons by Llew_Llaw_Gyffes
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.