ANN: Thinking in Tkinter
Steve Holden
sholden at holdenweb.com
Thu Sep 12 12:05:59 EDT 2002
"Stephen Ferg" <steve at ferg.org> wrote
> 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.
>
Correct. When you *want* the event data, of course (cursor position, etc.)
then bindings are a godsend. But the average programmer of end-user
applications gets most of what they need from a command callback.
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Previous .sig file retired to www.homeforoldsigs.com
-----------------------------------------------------------------------
More information about the Python-list
mailing list