Taking a screenshot

Full Screen

import pyautogui

pyautogui.screenshot("C:\\Users\\Nicholas Goh\\Desktop\\test.png")

Specific areas to screenshot can be specified by using the Region argument

import pyautogui

pyautogui.screenshot("C:\\Users\\Nicholas Goh\\Desktop\\test.png", region=(0, 0, 100, 200))

 

Replace C:\\Users\\Nicholas Goh\\Desktop\\test.png  with your own file path and file name. Double backslash in the file path \\ is required as \ is an escape character

 

Region requires an integer value and signifies in order: Left, Top, Width from Left, Height from Top


Revision #1
Created 17 April 2022 10:51:15 by Nicholas Goh
Updated 17 April 2022 11:01:47 by Nicholas Goh