in reply to How do Tk popup menus actually work?

The magic is in Tk::bind. By default, it supplies your callback with the widget object that triggered the event as an argument.

Look at the docs for Tk::callbacks, they have some examples that make it more clear. There is also some explanation on how to pass other args, or make method calls instead of a calling a generalized subroutine.

It is odd, though, that the docs for Tk::bind don't spell out the default behavior.

  • Comment on Re: How do Tk popup menus actually work?