in reply to Bind mishandles arguments

The code appears to be working just fine. The text of Mastering Perl Tk is online - look at Chapter 15. Read about the "The Event Structure" and "the event object". Tk is giving you as the first arg (0), the event object in your bind of the down arrow case. You can throw away this object reference if you want, but this event object can tell you a lot about the context of how this key got pressed. Maybe it does something different depending upon which Window has focus. The args provided by the -command in the Button object are different as you have noted. But of course in this case, you know exactly what got pushed in what window since you made the button.

Read chapter 15 and see if that helps.

Replies are listed 'Best First'.
Re^2: Bind mishandles arguments
by Anonymous Monk on May 31, 2011 at 21:44 UTC
    OK, many thanks -- let's just say it's somewhat surprising (to me) that "\&cmd, arg" produces different results in these two contexts, given that the purpose is so similar.