from kandinsky import * from random import randint class rect(): def __init__(self, x, y, w, h, c): self.x = x self.y = y self.w = w self.h = h self.c = c def affiche(self): for i in range(self.h): y = self.y + i for j in range(self.w): x = self.x + j v = list(get_pixel(x, y)) if i == self.h - 1 or i == 0 or j ==0 or j == self.w -1: rvb2 = (255,) * 3 else: rvb2 = list(self.c) for i in range(3): rvb2[i] = (rvb2[i] + v[i]) // 2 set_pixel(x, y, rvb2) color = [(255, 26 * i, 255 - 25 * i) for i in range(10)] for i in range(150): rect(randint(-20,310),randint(-20,220),randint(20,100),randint(20,100),color[i%10]).affiche()