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.22k stars 1.24k forks source link

FailSafeException is raised when the cursor is set to 0,0 before invoking pyautogui.moveTo ou pyautogui.click #822

Open fdgStilla opened 10 months ago

fdgStilla commented 10 months ago

Step to reproduce:

Note: I am using a Windows Virtual Machine and the mouse cursor position is always initialized to 0.0 when started, making it impossible to use pyautogui, for now I am using a workaround by using win32api.SetCursorPos before calling pyautogui

mikigo commented 9 months ago

If the mouse is over a coordinate in FAILSAFE_POINTS and FAILSAFE is True, the FailSafeException is raised.

The rest of the points are added to the FAILSAFE_POINTS list at the bottom of this file, after size() has been defined.

The points are for the corners of the screen, but note that these points don't automatically change if the screen resolution changes.

pyautogui.FAILSAFE = False