Double Click Mouse Event in Tkinter

S

scott_gui

Creating a Windows application:
<Double-Button-1> mouse event has a conflict when there is also a
binding to the <Button-1> event. It seems like a silly oversight that
performing a double click will also initiate the single click action.

Has anyone figured out a way to circumvent this problem? Right now I am
making the Double click function undo the action my Single click
function does, but this is very annoying, especially since the action
that is bound to the Single click flashes for a second.
 
F

Fredrik Lundh

scott_gui said:
Creating a Windows application:
<Double-Button-1> mouse event has a conflict when there is also a
binding to the <Button-1> event. It seems like a silly oversight that
performing a double click will also initiate the single click action.

If your design depends on your code being able to accurately figure out what
the user will do in the future, you may want to go back to the drawing board.
Has anyone figured out a way to circumvent this problem? Right now I am
making the Double click function undo the action my Single click
function does, but this is very annoying, especially since the action
that is bound to the Single click flashes for a second.

I don't think I've ever seen any recent application that does this (be-
cause all possible "solutions" are annoying), but I seem to recall that
the Explorer in some early version of Windows overloaded single and
double click actions by delaying the single click action (click and wait =
single click action, click and click = double click action).

To implement this in Tkinter, you can schedule an "after" task in the
Button-1 handler, and cancel it in the Double-Button-1 handler. But
a redesign is probably a better idea...

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top