dimmesdale has asked for the wisdom of the Perl Monks concerning the following question:

Yet again, I'm confused. It's late and I've spent most of the day working on this, so that may be why I missed it (or not :)

However, an error, seemingly out of no where popped up. I've been working on a callback function bound to a Button-1 click on a certain image type. Fine. Everything worked. Well, then I copied that line to another place in the file (reason would require knowledge of subroutine, which I don't think is needed for the question), and did some slight changes.

AND THEN...

NOTHING! Same thing as before, but the function was never entered! I removed the (rather commented out the) code I added, but still nothing. So it must have been something somehow got changed in the bind statement, or an assignment to some value that affects that -- but having beens staring at this code far too long I can't spot it (or maybe I'm looking in the wrong place). Here's what I think is relavent:

my $card_dir = 'C:\tk_proj\cards\gif'; my $ext = 'gif'; my $back = $canvas->Photo(-file => "$card_dir\\b1fv.$ext", -format => 'gif'); ... my $dk_img = $canvas->createImage(50,120, -image => $back); ... $canvas->bind($dk_img, "<Button-1>", [\&dk_clk, $deck, $waste]);

Anything I changed in the sub wouldn't take effect (it seems to me) untill the sub was called, so that can't be it. The sub isn't even being called.

Replies are listed 'Best First'.
Re: Tk binding slip up (dissapearance?)
by dree (Monsignor) on Jul 07, 2002 at 12:34 UTC
    You can try doing this:

    a function, say initialize_bind where you put all the thing you're going to bind.
    Then you can call it before Mainloop;

    my 2 cents (there's too few code ;) )
      Well, now I'm really stumped, 'cause I ran the script just now this morning and, it worked! Oh well.