Un petit script pour faire des dessins, avec de gros pixels. Utilisez les flèches pour déplacer le pinceau, le bouton OK pour peindre, et les chiffres pour changer de couleur (Utilisez la virgule pour le noir). Pour faire admirer votre ♥œuvre d’art♥, pressez le bouton Maison.
from kandinsky import * from ion import * from time import * def cree(x=11,y=8): mon_dict={} x=range(x) y=range(y) for a in x: for b in y: mon_dict[str(a)+","+str(b)]='white' #color(255,255,255)#'white' return mon_dict def visuel(mon_dict=cree()): for a,b in mon_dict.items(): x,y=a.split(",") fill_rect(int(x)*30,int(y)*30,30,30,b) x=0 y=0 couleur='yellow' fixer=False action=True mon_dict=cree(11,8) dimension=30 while True: if keydown(KEY_HOME): fixer=not fixer action=True sleep(0.1) if not fixer: if keydown(KEY_OK): mon_dict[str(x)+","+str(y)]=couleur if keydown(KEY_LEFT) and x>0: x-=1 action=True if keydown(KEY_RIGHT) and x*30<300: x+=1 action=True if keydown(KEY_UP) and y>0: y-=1 action=True if keydown(KEY_DOWN) and y*30<200: y+=1 action=True if keydown(KEY_ZERO): action=True couleur='white' if keydown(KEY_ONE): action=True couleur='yellow' if keydown(KEY_TWO): action=True couleur='blue' if keydown(KEY_THREE): action=True couleur='red' if keydown(KEY_FOUR): action=True couleur='purple' if keydown(KEY_FIVE): action=True couleur='green' if keydown(KEY_SIX): action=True couleur='orange' if keydown(KEY_SEVEN): action=True couleur='pink' if keydown(KEY_EIGHT): action=True couleur='brown' if keydown(KEY_NINE): action=True couleur='grey' if keydown(KEY_DOT): action=True couleur='black' if keydown(KEY_SHIFT): del mon_dict mon_dict=cree() action=True if action: visuel(mon_dict) sleep(0.1) if not fixer: fill_rect(x*dimension,y*dimension,dimension,dimension,color(180,180,180)) fill_rect(x*dimension+2,y*dimension+2,dimension-4,dimension-4,couleur) action=False