Créer un dessin aléatoire
from math import * from kandinsky import * from random import * import time def c(n,q,k): h=n p=0 a=1 if k==a: r=color(255,0,0) g=color(0,255,0) b=color(0,0,255) for i in range(n): o=randint(1,3) x=randint(0,320) y=randint(0,222) u=randint(0,320) v=randint(0,222) if o==1: set_pixel(x,y,r) else: set_pixel(x,y,g) if o==3: set_pixel(x,y,b) if get_pixel(u,v)=="(0,0,0)": n+=1 else: for i in range(n): p+=1 r=randint(0,255) g=randint(0,255) b=randint(0,255) x=randint(0,320) y=randint(0,222) u=randint(0,320) v=randint(0,222) m=get_pixel(u,v) rc=color(r,g,b) set_pixel(x,y,rc) if m == '(0,0,0)': n+=1 if q==a: print("") else: if p==h : time.sleep(2) draw_string("Fini",0,0)