O'Reilly logo
  • You Wang thinks this is interesting:

The answer is that the button click event is a callback function, and by the time the button is clicked by a user, the variables referenced in this function are known and do exist.

From

Cover of Python GUI Programming Cookbook

Note

bind enter key to func: action.bind('<Return>', lambda x: clickMe())