from kandinsky import * import time x = 50 y = 20 tC = 40 eC = 20 nbTour = 200 pause = 0.25 def carre1(R, G, B): fill_rect(x,y+2*(tC+eC),tC,tC,color(255,255,255)) fill_rect(x,y+tC+eC,tC,tC,color(120,120,120)) fill_rect(x,y,tC,tC,color(R,G,B)) def carre2(R, G, B): fill_rect(x,y+tC+eC,tC,tC,color(255,255,255)) fill_rect(x,y,tC,tC,color(120,120,120)) fill_rect(x+tC+eC,y,tC,tC,color(R,G,B)) def carre3(R, G, B): fill_rect(x,y,tC,tC,color(255,255,255)) fill_rect(x+tC+eC,y,tC,tC,color(120,120,120)) fill_rect(x+2*(tC+eC),y,tC,tC,color(R,G,B)) def carre4(R, G, B): fill_rect(x+tC+eC,y,tC,tC,color(255,255,255)) fill_rect(x+2*(tC+eC),y,tC,tC,color(120,120,120)) fill_rect(x+2*(tC+eC),y+tC+eC,tC,tC,color(R,G,B)) def carre5(R, G, B): fill_rect(x+2*(tC+eC),y,tC,tC,color(255,255,255)) fill_rect(x+2*(tC+eC),y+tC+eC,tC,tC,color(120,120,120)) fill_rect(x+2*(tC+eC),y+2*(tC+eC),tC,tC,color(R,G,B)) def carre6(R, G, B): fill_rect(x+2*(tC+eC),y+tC+eC,tC,tC,color(255,255,255)) fill_rect(x+2*(tC+eC),y+2*(tC+eC),tC,tC,color(120,120,120)) fill_rect(x+tC+eC,y+2*(tC+eC),tC,tC,color(R,G,B)) def carre7(R, G, B): fill_rect(x+2*(tC+eC),y+2*(tC+eC),tC,tC,color(255,255,255)) fill_rect(x+tC+eC,y+2*(tC+eC),tC,tC,color(120,120,120)) fill_rect(x,y+2*(tC+eC),tC,tC,color(R,G,B)) def carre8(R, G, B): fill_rect(x+tC+eC,y+2*(tC+eC),tC,tC,color(255,255,255)) fill_rect(x,y+2*(tC+eC),tC,tC,color(120,120,120)) fill_rect(x,y+tC+eC,tC,tC,color(R,G,B)) iTour = 0 while iTour < nbTour: carre1(0,0,0) time.sleep(pause) carre2(0,0,0) time.sleep(pause) carre3(0,0,0) time.sleep(pause) carre4(0,0,0) time.sleep(pause) carre5(0,0,0) time.sleep(pause) carre6(0,0,0) time.sleep(pause) carre7(0,0,0) time.sleep(pause) carre8(0,0,0) time.sleep(pause)