from time import * from turtle import * from ion import * from random import * import kandinsky kandinsky.fill_rect(0,0,320,222,'white') taille=1 x=0 y=0 vitesse=10 #commandes=input("Mode (1=Fleches) : ") commandes="1" if commandes == "1": fleches=True else: fleches=False if commandes == "0123456789": fleches=True egg=True else: egg=False showturtle() def main(fleches=False,taille=1,x=0,y=0,egg=False,vitesse=10): if keydown(KEY_EXE) or egg: colormode(255) color(randint(0,255),randint(0,255),randint(0,255)) hideturtle() showturtle() if keydown(KEY_ANS): hideturtle() #write(str(kandinsky.get_pixel(int(position()[0]),int(position()[1])))) #color(kandinsky.get_pixel(int(position()[0]),int(position()[1]))) color(255,255,255) showturtle() if keydown(KEY_BACKSPACE): reset() kandinsky.fill_rect(0,0,320,222,'white') x=0 y=0 penup() goto(x,y) if keydown(KEY_OK): if isdown(): penup() else: pendown() sleep(.5) if keydown(KEY_UP): y+=1 if fleches==False: forward(1) if keydown(KEY_DOWN): y-=1 if fleches==False: backward(1) if keydown(KEY_RIGHT): x+=1 if fleches==False: right(1) if keydown(KEY_LEFT): x-=1 if fleches==False: left(1) if keydown(KEY_MINUS): if taille>1: taille-=1 pensize(taille) if keydown(KEY_PLUS): taille+=1 pensize(taille) if keydown(KEY_DIVISION): if vitesse>1: vitesse-=1 speed(vitesse) if keydown(KEY_MULTIPLICATION): if vitesse<10: vitesse+=1 speed(vitesse) if fleches: goto(x,y) return x,y,taille,vitesse print(__name__) while True: try: x,y,taille,vitesse=main(fleches,taille,x,y,egg,vitesse) except MemoryError: taille-=1