In this recipe, we will be learning to display the x and y coordinates where the mouse button is clicked, along with the coordinates of where the mouse button is released.
Displaying coordinates where the mouse button is clicked and released
How to do it...
Two methods, mousePressEvent() and mouseReleaseEvent(), will play major role in this recipe. The mousePressEvent() method will be automatically invoked when the mouse is pressed and will reveal the x and y coordinates when the mouse press event has occurred. Similarly, the mouseReleaseEvent() method will be invoked automatically whenever the mouse button is released. Two Label widgets will be used in this recipe to display the coordinates where the mouse button is clicked and where...