question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PyAutoGui slow calls to moveto() on Mac OS X

See original GitHub issue
for y in range(landscapeRegion[1], landscapeRegion[1] + landscapeRegion[3], 40):
         for x in range(landscapeRegion[0], landscapeRegion[0] + landscapeRegion[2], 40):
             bot.moveTo(x, y, 0)
             bot.click(button='right')

The moveTo() takes about half a second between moves. The move is instant but it will sit at it’s destination for half a second even though the moveTo is being called rapidly.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
rakshit97commented, Mar 14, 2018

Hey, I tried a lot of different things but there was always a delay between actions. For rapid movements, I would suggest that you shift to Java and use the inbuilt java.awt.Robot class for mouse and keyboard, which is quite powerful and seamless. When rapid movements are not required, PyAutoGui is a great library.

0reactions
DanyilVoloschukcommented, Jan 27, 2022

I also experience PyAutoGui to be very slow. After every click there is a huge delay of some 100 ms. Also the moveTo command seems slow. Is this a known issue? I cannot imagine why it should be so slow.

I am testing PyAutoGui as a replacement for pynput because PyAutoGui has a more liberal license. With pynput I did not experience such issues. What is pynput doing different compared to PyAutoGui?

Using Java (introducing whole new platform) is hardly an option here. Will try mouse lib next.

EDIT: The mouse lib works like a charm for me (on Windows) and is MIT licensed. Recommended!

just write

pyautogui.PAUSE = 0.00000001

or just

pyautogui.PAUSE = 0
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get pyautogui's click/moveTo working on mac?
The movement works for me (on Windows), though I do get the message pyautogui.FailSafeException: PyAutoGUI fail-safe triggered from mouse moving ...
Read more >
Mouse Control Functions - PyAutoGUI documentation
The moveTo() function will move the mouse cursor to the X and Y integer coordinates you pass it. The ; (If the duration...
Read more >
PyAutoGUI Documentation - Read the Docs
PyAutoGUI works on Windows, macOS, and Linux, and runs on Python 2 and 3 ... The moveTo() function will move the mouse cursor...
Read more >
PyAutoGUI not working? Use DirectInput - YouTube
PyAutoGUI does not work for all video games, so I wrote PyDirectInput to solve this. With it, you can easily swap your PyAutoGUI...
Read more >
20 controlling the keyboard and mouse with gui automation
Windows and macOS users can simply use pip to install PyAutoGUI. ... moveTo() calls, the mouse cursor would have instantly teleported from point...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found