seems simple, but i don't get what i expect. in particular,
if i press a mouse button while pointing to one object, then drag
to another and release, the release event callback tells me i
was pointing to the first object. i've distilled it down to a
small test case, attached below.
this seems like a bug to me, but experience has shown that it's
probably a misconception on my part about how the event handling
is supposed to work.
anyone have any ideas?
------------------------- code follows -----------------------
from Tkinter import *
def Up( id ):
print 'Up:', id
def Down( id ):
print 'Down:', id
root = Tk()
canvas = Canvas( root )
canvas.pack()
Wid = 40
Hgt = 25
x, y = 100, 64
shape1 = canvas.create_oval( x-Wid, y-Hgt, x+Wid, y+Hgt, fill='red' )
x, y = 200, 64
shape2 = canvas.create_oval( x-Wid, y-Hgt, x+Wid, y+Hgt, fill='blue' )
canvas.tag_bind( shape1, "<1>", lambda e: Down( 'shape1' ) )
canvas.tag_bind( shape1, "<ButtonRelease-1>", lambda e: Up( 'shape1' ) )
canvas.tag_bind( shape2, "<1>", lambda e: Down( 'shape2' ) )
canvas.tag_bind( shape2, "<ButtonRelease-1>", lambda e: Up( 'shape2' ) )
root.mainloop()
--
Garry Hodgson And it's just a box of rain
Software Innovation Services I don't know who put it there
AT&T Labs Believe it if you need it
ga...@sage.att.com Or leave it if you dare