from kandinsky import fill_rect from time import sleep from gif0 import * w,h = 74,28 r = 5 COUL = [(0,0,0),(255,0,0)] def taille(n): return 54 * (n[0] - 35) + n[1] - 34 def remplir(x,y,t,c): while t > 0: d = min(t, w - x) fill_rect(-25+r*x,80+r*y,r*d,r,c) x += d t -= d if x == w: x = 0 y += 1 if y >= h: y = 0 return x,y def aff(): k = 0 while True: k = (k + 1) % 5 img = memoire(k) i = 0 x,y = 0,0 while i < len(img): v = img[i] if v in (32, 33): c = v - 32 i += 1 sleep(.2) else: t = taille(img[i:i+2]) x,y = remplir(x,y,t,COUL[c]) i += 2 c = 1 - c fill_rect(0,0,320,222,COUL[0]) aff()