You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
997 B
52 lines
997 B
import turtle |
|
|
|
# Initialisation de la fenêtre |
|
screen = turtle.Screen() |
|
screen.bgcolor("white") |
|
screen.title("Dessin d'un singe") |
|
|
|
# Initialisation de la tortue |
|
pen = turtle.Turtle() |
|
pen.shape("turtle") |
|
pen.speed(8) |
|
|
|
# Fonction pour dessiner un cercle |
|
def draw_circle(color, radius, x, y): |
|
pen.penup() |
|
pen.goto(x, y) |
|
pen.pendown() |
|
pen.begin_fill() |
|
pen.color(color) |
|
pen.circle(radius) |
|
pen.end_fill() |
|
|
|
# Dessin de la tête |
|
draw_circle("brown", 100, 0, -100) |
|
|
|
# Dessin des oreilles |
|
draw_circle("brown", 40, -100, -50) |
|
draw_circle("brown", 40, 100, -50) |
|
|
|
# Dessin des yeux |
|
draw_circle("white", 30, -50, 0) |
|
draw_circle("white", 30, 50, 0) |
|
|
|
# Pupilles |
|
draw_circle("black", 10, -50, 30) |
|
draw_circle("black", 10, 50, 30) |
|
|
|
# Dessin du nez |
|
draw_circle("black", 20, 0, -30) |
|
|
|
# Dessin de la bouche |
|
pen.penup() |
|
pen.goto(-40, -60) |
|
pen.pendown() |
|
pen.setheading(-60) |
|
pen.circle(40, 120) |
|
|
|
# Masquer la tortue après le dessin |
|
pen.hideturtle() |
|
|
|
# Garde la fenêtre ouverte |
|
turtle.done()
|
|
|