tkinter event binding to mouse double click
Emile van Sebille
emile at fenx.com
Tue Dec 19 10:33:53 EST 2000
Both versions work for me on Win95, Win2k and linux.
Emile van Sebille
emile at fenx.com
June Kim wrote:
> "John Grayson" <johngrayson at home.com> wrote in message
> news:91njgc$l4q$1 at nnrp1.deja.com...
>
>> 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
>
>
> Well, it doesn't work, either. Probably it will work on linux but not on
> win32.
> Thanks anyway.
>
> Best Regards,
>
> June
More information about the Python-list
mailing list