[Tkinter-discuss] get quickly, very fast and directly items in a canvas from a moving button mouse
mistervanhalen at gmail.com
Sat Feb 4 14:33:43 CET 2012
I have got a canvas, where I created some items (rectangles and letters). I
want to catch quickly and directly every item when I move my mouse holding
I managed to do something but when the movement is too fast, all items are
Here is my code
event is from a bind of
canvas.bind('<B1-Motion>', lambda event,a="B1m":self.select(event, a))
def select(self, event, typeofevent):
# get the canvas object
canvas = event.widget
# find object close to mouse
x = canvas.canvasx(event.x)
y = canvas.canvasy(event.y)
item = canvas.find_closest(x, y, halo=None, start=None)
This code works but when my mouse moves too fast, all items are not select.
I think self.select is called every x milliseconds, so when it is too fast,
it misses some items.
Is there a solution to manage that? I want to get item directly when my
mouse is over and button is held.
Thank you for your help,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tkinter-discuss