Question: is there any code that can detect if any pixel color changes ? 

what i want to do is to detect any change in a region if pixels 

so if the color of any pixel in that region changed , it alerts me . 

sorry for my bad English .

Answer: 
To find the exact difference between consecutive screenshots:

```
#!/usr/bin/env python
from PIL import ImageChops # $ pip install pillow
from pyscreenshot import grab # $ pip install pyscreenshot

im = grab()
while True: # http://effbot.org/zone/pil-comparing-images.htm
    diff = ImageChops.difference(grab(), im)
    bbox = diff.getbbox()
    if bbox is not None: # exact comparison
        break

print("bounding box of non-zero difference: %s" % (bbox,))
# superimpose the inverted image and the difference
ImageChops.screen(ImageChops.invert(im.crop(bbox)), diff.crop(bbox)).show()
input("Press Enter to exit")

```
An intuitive solution could be the folllowing:

```
1) Take the bytes of the region you want to check for changes
2) Convert them to a string of bytes
3) Use an hash function from the hashlib module
4) Compare the obtained hash with the previous one
   (if they're different something has changed)

```

This approach detect any change also in light conditions, so may not be what you want. But this truly detect **ANY change** in the portion of the image.

There are also some libraries binding like `PyOpenCV` that can do this and a lot more.