Search code examples
python-3.xpyautogui

Is there a delay function for taking screenshots with pyauto.gui?


I was wondering is there a delay function for taking screenshots using pyautogui? I am trying to create a script or code that uses images to do tasks using pyautogui. However, the only delay function I could find was interval but that was only in relation to typing. I am trying to take a screenshot of a extension that I have to right click to open it's other features but can't screenshot it because when I go to the IDLE Shell it closes the pop up box. I have tried the following but does not work.

p2 = pyautogui.screenshot(), interval=2

I have also previously tried using Snipping Tool but can't locate the images if I use it and the same applies for the Windows Screenshot shortcut?


Solution

  • You can use the Windows screenshot shortcut and it works, so don't need another function but as someone else mentioned can use the time module.

    Also to note that use confidence = 0.9 to help locate pictures when using pyautogui as 1 = 100% match. This is what I had the most difficulty with as pyautogui could not locate the image I had saved, used all the parameters and 0.9 worked for me.