Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)

Value check stays the same no matter what color does it get. It should give me RGB value of exact pixel every second

I tried doing it in recursion, simplified it, tested on multiple objects, result stays the same.

im = pg.screenshot()

import time

while True:

        check=im.getpixel((216, 169))

        time.sleep(1)

        print(check)

I expected the dynamically changing output depending on the color of pixel (216, 169). Currently I receive the same RGB value every second

1 Answer

0 votes
by (29.5k points)

you're taking the screenshot once and then re-checking it over and over

code given takes new screenshots every second.
below 

while True:
        im = pg.screenshot()
        check = im.getpixel((216, 169))
        time.sleep(1)
        print(check)

Browse Categories

...