asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

how to get x,y coordinate #773

Open WeemaUnseen opened 1 year ago

WeemaUnseen commented 1 year ago

hello ,

could you please tell me how to get x,y,height,width coordinates for a specific area , I've tried to do but failed

Asublime01 commented 1 year ago

hello ,

could you please tell me how to get x,y,height,width coordinates for a specific area , I've tried to do but faile

Run pyautogui.displayMousePosition() and hover your mouse over the "specific area" and it will show those cords

doper1 commented 1 year ago

hello ,

could you please tell me how to get x,y,height,width coordinates for a specific area , I've tried to do but failed

You can also use "print(pyautogui.position())" to get the mouse coordinates as an output. Output example:

Point(x=251, y=416)