Tkinter Drag and Drop image using Left mouse button press and move event using canvas
2.9 هزار بار بازدید -
2 سال پیش
-
We can read the event
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/tkint...
#DND_image #MouseMovement #DragNDrop #MouseEvent #plus2net #tkinter #imageMovement
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/tkint...
#DND_image #MouseMovement #DragNDrop #MouseEvent #plus2net #tkinter #imageMovement
2 سال پیش
در تاریخ 1401/03/16 منتشر شده
است.
2,930
بـار بازدید شده