tkinter event binding to mouse double click

John Grayson johngrayson at home.com
Tue Dec 19 07:15:09 EST 2000


In article <91n7l6$7ij$1 at news.nuri.net>,
  "June Kim" <junaftnoon at nospamplzyahoo.com> wrote:
> I'm using Python 2.0 on Win32.
> In the code following, the binding doesn't seem to work; it can't
detect
> mouse double-clicking at all. (Maybe a platform-specific problem, I
reckon)
>
> from Tkinter import *
>
> root = Tk()
>
> def callback(event):
>     print "clicked at", event.x, event.y
>
> frame = Frame(root, width=100, height=100)
> frame.bind("<Double-Button-1>", callback)
> frame.pack()
>
> root.mainloop()
>
>

The problem is that you have to click on the *frame* not the (empty)
space in the frame.

Try this:

frame = Frame(root, bg='red', width=100, height=100)


John Grayson


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list