One of the key user interface paradigms when you develop Windows software is the ability for users to interact with objects on the screen with their mouse. Most often this means being able to click things but over time the concept of being able to drag – and drop – items has become a common capability. It enables users to be able to do things like reorder lists, add items to selections or groups in a more natural way or to copy objects such as files from one place to another.
In this tutorial, you will be learning how to drag and drop images across a canvas with a mouse. Dragging and falling images on a canvas with Tkinter and Python is actually very fast. You will bind B1-Motion. B1 stands for Button 1, which is a reflection of holding down the left mouse button. The Motion is supposed to move your mouse around. You will also be shown how to output the x and y mouse movement coordinates to the screen, just so we can see what’s going on behind the screen as you move the mouse around.
Download a free trial of Delphi today and use it with Python to make great apps with amazing functionality.