Python Forum
How to get mouse coordinates on click and release - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to get mouse coordinates on click and release (/thread-18435.html)



How to get mouse coordinates on click and release - OhNoSegFaultAgain - May-17-2019

Hello everybody, I need to find a way to get the corners coordinates of the rectangle it's formed when selecting part of the screen. In other words:
1) I click (get coordinates)
2) I move the mouse
3) I release (get coordinates)

The second thing: how do I tell the program to treat the click&drag as a "select area" instead of "highlight text"?

I don't even know what library I should use Think


RE: How to get mouse coordinates on click and release - buran - May-17-2019

for listening for mouse events - check pynput package
here is the relevant part of the docs - https://pynput.readthedocs.io/en/latest/mouse.html#monitoring-the-mouse

I am not sure what you mean in the second part of the question