easter.py

Created by schraf

Created on April 09, 2023

553 Bytes

Vidéo sur comment dessiner un ovale avec la tortue Python


from turtle import *
from random import *

hideturtle()

coul = (250,120,130),(140,200,40),(65,170,245),(250,160,45)
 
def oeuf(r):
 for (d,a) in (1,180),(2,45),(.586,90),(2,45): circle(int(d*r),a)

for c in range(10):
 for l in range(5):
    color(choice(coul))
    penup()
    goto(-140 + 30 * c,-85 + 42 * l)
    pendown()
    setheading(randint(-30,30)) 
    pensize(3)
    for i in range(1, 10, 2): 
        if random() < .2: color(choice(coul))
        if i == 9: 
            color((60,60,60))
            pensize(2)
        oeuf(i)