This answer is similar in concept to Hank's answer but requires less code.
You can use pyautogui to take screenshots of your screen (which will require installing using pip or conda).
What the code does is take and save an initial first screenshot, and then begin a loop. Each time, the loop takes a new screenshot, compares the two screenshots, and then sets the 1st screenshot as the 2nd one. This way we can take one screenshot every time instead of two and make the script faster and less process consuming.
We can then use read() to read the pixel values of both images and check for differences. Because we use the same method to take them, in this case you won't need to worry about quality or compression.
import pyautogui
region_of_screen = (0, 0, 300, 300) #You can change the place of the screen you want to monitor here
croppedscreen = pyautogui.screenshot(region=region_of_screen).save('./screen1.png') #You can also use `pyautogui.screenshot()` with no `region` to capture the entire screen instead
while True: # While loop to constantly check
croppedscreen2 = pyautogui.screenshot(region=region_of_screen) #Take the 2nd screenshot
croppedscreen2.save('./screen2.png') #Save 2nd screenshot
if open("screen1.png","rb").read() == open("screen2.png","rb").read(): #Compare pixel values of both images
print('No changes detected')
else:
print('Changes detected!')
croppedscreen = croppedscreen2 #Since we're detecting changes between each screenshot, we can save resources by using the 2nd screenshot as our 1st one and taking a new screenshot to compare it with.
croppedscreen.save('screen1.png')