How can I improve my color change programm?

Viewed 32

A few days ago I found a couple of dead pixels on my laptop screen. Googled how to remove them without going to the service center, but nothing helped. I decided to create a simple code myself to go through all possible colors in order to finally make a verdict on whether I should go to a service center or not.

I decided to write code in Python, because on I can quickly create an algorithm that would solve my problem, but I met with a problem in speed.

Walking through one color (blue in my case) takes about 1.64 seconds, then it takes about 29 hours to walk through all the colors, which is quite a long time. Is there any way to speed up the process? Or should I choose some other method?

import pygame

WIDTH = 200
HEIGHT = 200
FPS = 144

pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
clock = pygame.time.Clock()

running = True

r = 0
g = 0
b = 0

while running:
    clock.tick(FPS)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    b += 1

    if b % 256 == 0:
        b = 0
        g += 1

        if g % 256 == 0:
            g = 0
            r += 1

            if r % 256 == 0:
                break

    screen.fill((r, g, b))
    pygame.display.flip()
0 Answers
Related