from kandinsky import * BL,WH,GR,RE = (0,0,0),(248,252,248),(230,)*3, (255,0,0) def dot(x,y,c,fg,bg,t,a,b): draw_string(c,0,0,GR,WH) fill_rect(x,y,9*t,18*t,bg) for i in range(380): u,v=i%9,i//18 if get_pixel(u,v)!=WH: fill_rect(x+u*t,y+v*t,t-a,t-b,fg) draw_string(" ",0,0,WH,WH) def aff(txt,x,y,t,fg,bg=WH,a=1,b=1): for (i,c) in enumerate(txt): dot(x+i*t*9,y,c,fg,bg,t,a,b) # Exemples aff('Score',20, -5, 6, BL,GR,a=3,b=-2) aff('0123456789',20,85,3,RE,a=2,b=2) for i in range(26): aff(chr(97+i),25+10*i,132,1,BL,GR,-2,0) aff(chr(65+i),25+10*i,172+30*(i%2)-15,2,[BL,RE][i%2],a=-1,b=-2)