KC_ZAY
2 months ago
1 changed files with 52 additions and 0 deletions
@ -0,0 +1,52 @@
|
||||
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() |
Loading…
Reference in new issue