from kandinsky import * from time import sleep BL, NR,VE = (255,)*3, (0,)*3,(0,255,0) def fond(): fill_rect(0,0,320,222,NR) for k in range(32): fill_rect(10*k,0,2,222,BL) def visage(): fill_rect(70,55,172,8,NR) fill_rect(70,63,172,60,BL) fill_rect(110,123,90,70,BL) for k in range(2): fill_rect(100*k+70,70,72,27,NR) fill_rect(100*k+70,77,64,2,BL) fill_rect(100*k+76,85,58,2,BL) fill_rect(100*k+132,77,2,16,BL) fill_rect(134,70,8,70,NR) for [x,y] in [[145,130],[156,130]]: carre(x,y,NR,BL) dents(150) dents(163) def dents(y,f=NR,b=BL): for x in [112,192]: carre(x,y - 6,f,b) for k in range(7): carre(122 + 10 *k ,y,f,b) def carre(x,y,f,b): fill_rect(x,y-2,8,12,b) fill_rect(x,y,8,10,f) def anim_bouche(n): pos = [0,1,2,3,2,1,0] t = len(pos) for i in range(n): for k in range(t): dents(163 + 5 * pos[k%t], BL,BL) dents(163 + 5 * pos[(k+1)%t], NR,BL) sleep(.03) def anim_yeux(n): for i in range(n): for k in range(14): v = k if k < 7 else 14 - k fill_rect(77,89,50,8,NR) fill_rect(79+ 4 * v,89,20,8,BL) fill_rect(177,89,50,8,NR) fill_rect(179+ 4 * v,89,20,8,BL) sleep(.03) fond() visage() while True: anim_yeux(2) anim_bouche(9) anim_yeux(4) anim_bouche(10) anim_yeux(4) anim_bouche(15)