take a screenshot of desktop python PIL code example
Example: python saving a screentshot with PIL
#python 3
from PIL import ImageGrab
snapshot = ImageGrab.grab()
save_path = "C:\\Users\\YourUser\\Desktop\\MySnapshot.jpg" #dont forget to write the name and the extension of the file in the end
snapshot.save(save_path)