in reply to Tk starting and stopping an autoplay loop using a keybinding

The ternary operator ?: is not a statement but an expression. You should assign its result, not run two statements:

$toggle_autoplay = ($toggle_autoplay == 0) ? 1 : 0;

or, a bit shorter:

$toggle_autoplay = !$toggle_autoplay;

Replies are listed 'Best First'.
Re^2: Tk starting and stopping an autoplay loop using a keybinding
by tybalt89 (Monsignor) on Oct 03, 2016 at 18:48 UTC

    Or, a bit shorter:

    $toggle_autoplay ^= 1;

    Just to confuse things,

    $toggle_autoplay == 0 ? $toggle_autoplay = 1 : ($toggle_autoplay = 0);

    would have worked (because it fixes the precedence problem you were having).

Re^2: Tk starting and stopping an autoplay loop using a keybinding
by Discipulus (Canon) on Oct 03, 2016 at 08:23 UTC
    ..oops me bad! thanks

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.