I'm trying to create a function that allows you to select an image on a Canvas by clicking on it, then with the same mouse button, click on the Canvas to teleport this image to the coordinates of the second click.
Currently I know how to select the image using find_closest
, move it with coords
but I don't know how to write the code.
for now I have :
self.cnv.bind('<Button-1>', self.select)
def select(self, event):
self.item = self.cnv.find_closest(event.x, event.y)
self.cnv.coords(self.item, event.x, event.y)
but it just moves the image directly when I click on it, whereas I would like to select it first and then move it with a second click.