What this program is supposed to do is once the pygame window is opened with the image, coordinates from a mouse click on the window are grabbed and used into a loop that changes and sets the rgb values to a "negated effect" in a scaled region.
My question related to how these loops can be integrated to function to its intended purpose?
import pygame
import sys
from pygame.locals import *
simage = pygame.image.load(sys.argv[1]) #retrieve image from command arg
(w, h) = simage.get_size()
window = pygame.display.set_mode((w, h))
window.blit(simage, (0,0))
a = 0
b = 0
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
mouse_presses = pygame.mouse.get_pressed()
if mouse_presses[0]:
print("mouse")
(a, b) = pygame.mouse.get_pos()
for y in range(a, a*10):
for x in range(b, b*10):
(r, g, b, _) = simage.get_at((x, y))
simage.set_at((x, y), 255-r, 255-g, 255-b)
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
