What is the difference between Python's pyautogui.PAUSE and time.sleep?

20.2k views Asked by At

I've noticed that pyautogui.PAUSE makes my program run slightly slower. I'm wondering why this is?

2

There are 2 answers

0
JacobIRR On

From the source code:

PAUSE = 0.1 # The number of seconds to pause after EVERY public function call. Useful for debugging.

So essentially, each function is slowed down by 0.1 seconds, hence the slowdown.

0
Dayana On

The method sleep() suspends execution for the given number of seconds. Example:

time.sleep(5)

the execution will be suspended for 5 seconds.

In the case of pyautogui.PAUSE allows you to add delays after PyAutoGUI’s functions. For more information you could read: sleep and pause

So, both functions add pause, that may be the reason for slowness. I hope this help you.