Multiplicity and Asininity in Tkinter Event API

rantingrick rantingrick at gmail.com
Fri Jul 15 15:54:08 CEST 2011


On Jul 15, 1:17 am, Chris Angelico <ros... at gmail.com> wrote:
> On Fri, Jul 15, 2011 at 8:34 AM, rantingrick <rantingr... 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.

NO these six sequences are ALL you need!

I suppose you are "suggesting" that you will be unable to detect when
the mouse is "repeat-firing" or when you want to detect groups of
"rapid-succession" clicks (double, triple, etc)? This info is
contained in the 'event' object passed to the handler by Tkinter.

    if event.time >[<] lasttime:
        blah
    if event.repeat:
        blah

By removing all the unnessary sequence combinations you create
readable code and ease the leaning curve.

>  Since you have MouseRelease, I am
> guessing that it's MouseButtonDown (or MousePress, to parallel your
> KeyPress/KeyRelease).

Ok Mr. Pedantic. I suppose for unity sake we should use the sequence
name "<MousePress>" instead of <MouseClick>. I'll give you that one.



More information about the Python-list mailing list