Multiplicity and Asininity in Tkinter Event API

Chris Angelico rosuav at gmail.com
Fri Jul 15 02:17:56 EDT 2011


On Fri, Jul 15, 2011 at 8:34 AM, rantingrick <rantingrick at gmail.com> wrote:
>  <KeyPress>
>  <KeyRelease>
>  <MouseClick>
>  <MouseMotion>
>  <MouseRelease>
>  <MouseWheel>
>
> That's it. Go ahead, try to prove me wrong!
>

Does MouseClick mean Mouse Button Down, or does it mean Mouse Button
Pressed Then Released Within A Short Time Without The Mouse Moving In
Between? Both events are needed. Since you have MouseRelease, I am
guessing that it's MouseButtonDown (or MousePress, to parallel your
KeyPress/KeyRelease).

If you only have MouseDown and MouseUp events (or MousePress and
MouseRelease, whatever you wish to call them), then users have a lot
of trouble implementing CUA-compliant mouse-click handlers.

In the spirit of Ook and its predecessor, I propose one single event:
InputEvent. It will have a parameter that specifies the key ID or
mouse button that triggered the event; 0 means no key/button, and
indicates a mouse movement event. It will contain the location of the
mouse, and it's up to the program to keep track of the last known
mouse location, to detect movement. The beauty of this system is that
programmers can build interfaces that involve pointing at an object,
holding the four keys D-R-A-G, and moving the mouse to another
location and releasing those keys. This is far more intuitive than the
classic mouse-button way of dragging objects around, and avoids the
age-old debate of whether to drag with the left or right mouse button.
Tkinter should provide this facility so that all new programs will be
written with this in mind.

Chris Angelico



More information about the Python-list mailing list