Python Forum
How to get mouse coordinates on click and release
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get mouse coordinates on click and release
#1
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
Reply
#2
for listening for mouse events - check pynput package
here is the relevant part of the docs - https://pynput.readthedocs.io/en/latest/...-the-mouse

I am not sure what you mean in the second part of the question
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Non repetitive mouse click Sartre 5 1,415 Apr-22-2023, 06:46 PM
Last Post: deanhystad
  how to mouse click a specific item in pygame? Frankduc 5 1,709 May-03-2022, 06:22 PM
Last Post: Frankduc
  Move mouse and click in particular position biprabu 3 2,489 Sep-01-2020, 08:23 PM
Last Post: deanhystad
  Slide show with mouse click pausing aantono 1 2,190 Jan-28-2020, 04:25 AM
Last Post: Larz60+
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,514 Dec-06-2019, 09:51 PM
Last Post: Larz60+
  Why is left mouse click not working? yeto 3 6,174 Jul-15-2019, 05:23 AM
Last Post: Yoriz
  Python 3.4: the only release to create .EXE standalone without .dll samsonite 7 5,792 Feb-28-2019, 09:20 AM
Last Post: samsonite
  How to release control of file jmair 2 2,775 Oct-03-2018, 08:22 PM
Last Post: jmair
  Python catch mouse click in pure text, no graphics samtal 7 7,227 Sep-10-2018, 03:02 PM
Last Post: samtal
  Release kbhit Epilepsy 2 4,301 May-26-2018, 10:47 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020