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.47k stars 1.27k forks source link

maybe pyautogui can't run correctly in Win11 #774

Open GOT-youze opened 1 year ago

GOT-youze commented 1 year ago

In win11, my pyautogui modules can just carry out its task on the shell page, instead of all my screen. And my mouse pointer couldn't move when it run to 'pyautogui.moveTo(x1,y1)'.But, after run 'pyautogui.moveTo(x1,y1)',codes run to 'print(pyautogui.position())'.I get (x1,y1), but my mouse pointer isn't in (x1,y1) because it didn't move at all. So, how can I solve this problem?

DefSw0rd commented 1 year ago

Same problem on Windows 10 LTSB 2016 x64(python3.10.1,pyautogui==0.9.53)

DefSw0rd commented 1 year ago

Use ’duration‘ arguments to show the 'visual' mouse movement correctly: pyautogui.moveTo(100, 100, duration = 0.5) # spend 0.5 second to move your mouse to ScreenPos (100,100) You should make the interval of 'duration' arg more than 0.3 seconds (Only tested on my computer), below this number you cannot 'see' your mouse movement