ANN: Thinking in Tkinter
steve at ferg.org
Thu Sep 12 15:04:54 CEST 2002
Thanks for the tips on where to find Human Interface Guidelines.
> It's a fairly universal principle in Tk that the
> "command" of a widget is invoked according to the
> standard behaviour of that widget, so I think it
> deserves treatment as a fundamental principle
> on the same footing as event binding.
Absolutely! This observation is GOLD! This is just the kind of thing
I'm trying to get at in "Thinking in Tkinter".
Let me make sure I've got it right. We have two fundamental, and
different, approaches to specifying the behavior of a widget.
(1) event binding, in which you get to "roll your" own bindings by
binding callbacks to particular events that you specify.
(2) command binding, in which a standard behavior for a widget is
already defined for you by Tkinter (and Tk), and you bind a callback
to that standard behavior.
This explains why "command" binding doesn't automatically pass an
event object the way that event binding does. The standard behavior
of a widget might be defined across multiple kinds of events (e.g.
Button's standard behavior is defined across both a button-press and a
button-release), so there is no *single* event that could be passed.
More information about the Python-list