We can read the event created when mouse is on move and left button is pressed. We can read the x ( horizontal ) , y ( vertical ) coordinates by reading event.x and event.y values.
When the mouse is on move we will trigger one call-back function. Inside this function we will read the x and y coordinates and update the label text option by using config. We will display the x and y values in this Label.
One creating will be added to window and inside this canvas we will place one image.
Inside the call-back function we will update the coordinates of this image based on the x and y values of the mouse movement.
Using this we can move the image within the canvas.
Download the source code from here
https://www.plus2net.com/python/tkinter-events-dnd.php
#DND_image #MouseMovement #DragNDrop #MouseEvent #plus2net #tkinter #imageMovement