To draw any shape with the mouse, you need to know where the mouse button is clicked, to where the mouse is dragged, and where the mouse button is released. Only after knowing the coordinates where the mouse button is clicked can you go ahead and execute commands to draw different shapes. In this recipe, we will be learning to display the x and y coordinates to which the mouse is moved on the form.
Displaying mouse coordinates
How to do it...
In this recipe, we will be tracking mouse movement and will be displaying the x and y coordinates which the mouse is moved on the form. So, in all, we will be using two Label widgets in this application, one for displaying a message and the other for displaying mouse coordinates. The...