# ############################################################### # Paysage dessiné en utilisant le module Turtle de Python # Juin 2026 # nsi.gecif.net # ############################################################### import turtle # ===================================================== # CONFIGURATION # ===================================================== ecran = turtle.Screen() ecran.setup(1200, 800) ecran.title("Paysage avec Turtle - nsi.gecif.net") ecran.bgcolor("skyblue") t = turtle.Turtle() t.speed(0) t.hideturtle() # ===================================================== # OUTILS DE DESSIN # ===================================================== def rectangle(x, y, largeur, hauteur, couleur): t.penup() t.goto(x, y) t.setheading(0) t.color(couleur) t.begin_fill() t.pendown() for _ in range(2): t.forward(largeur) t.left(90) t.forward(hauteur) t.left(90) t.end_fill() def cercle_centre(x, y, rayon, couleur): t.penup() t.goto(x, y - rayon) t.color(couleur) t.begin_fill() t.pendown() t.circle(rayon) t.end_fill() def polygone(points, couleur): t.penup() t.goto(points[0]) t.color(couleur) t.begin_fill() t.pendown() for p in points[1:]: t.goto(p) t.goto(points[0]) t.end_fill() # ===================================================== # SOLEIL # ===================================================== def soleil(x, y): cercle_centre(x, y, 50, "gold") t.color("gold") t.pensize(3) for angle in range(0, 360, 30): t.penup() t.goto(x, y) t.setheading(angle) t.forward(60) t.pendown() t.forward(30) # ===================================================== # NUAGE # ===================================================== def nuage(x, y): cercle_centre(x, y, 25, "white") cercle_centre(x + 25, y + 10, 30, "white") cercle_centre(x + 55, y, 25, "white") cercle_centre(x + 15, y - 10, 25, "white") # ===================================================== # MAISON # ===================================================== def maison(x, y): rectangle(x, y, 220, 150, "#D8B080") polygone([ (x - 20, y + 150), (x + 110, y + 250), (x + 240, y + 150) ], "#8B0000") rectangle(x + 90, y, 40, 80, "#654321") rectangle(x + 30, y + 70, 40, 40, "lightblue") rectangle(x + 150, y + 70, 40, 40, "lightblue") # ===================================================== # ARBRE # ===================================================== def arbre(x, y): rectangle(x - 15, y, 30, 120, "sienna") cercle_centre(x, y + 140, 45, "forestgreen") cercle_centre(x - 35, y + 120, 40, "forestgreen") cercle_centre(x + 35, y + 120, 40, "forestgreen") cercle_centre(x, y + 90, 40, "forestgreen") # ===================================================== # IMMEUBLE # ===================================================== def immeuble(x, y): rectangle(x, y, 120, 300, "lightgray") for ligne in range(6): for colonne in range(3): rectangle( x + 15 + colonne * 35, y + 20 + ligne * 45, 20, 25, "lightyellow" ) # ===================================================== # VOITURE # ===================================================== def voiture(x, y): rectangle(x, y, 180, 40, "red") polygone([ (x + 30, y + 40), (x + 60, y + 80), (x + 120, y + 80), (x + 150, y + 40) ], "red") polygone([ (x + 50, y + 45), (x + 70, y + 70), (x + 110, y + 70), (x + 130, y + 45) ], "lightblue") cercle_centre(x + 45, y, 20, "black") cercle_centre(x + 135, y, 20, "black") cercle_centre(x + 45, y, 8, "gray") cercle_centre(x + 135, y, 8, "gray") # ===================================================== # PERSONNAGE # ===================================================== def personnage(x, y): cercle_centre(x, y + 90, 20, "#FFDAB9") t.color("black") t.pensize(3) t.penup() t.goto(x, y + 70) t.pendown() t.goto(x, y + 10) t.goto(x - 25, y + 40) t.penup() t.goto(x, y + 40) t.pendown() t.goto(x + 25, y + 40) t.penup() t.goto(x, y + 10) t.pendown() t.goto(x - 20, y - 30) t.penup() t.goto(x, y + 10) t.pendown() t.goto(x + 20, y - 30) # ===================================================== # FLEUR # ===================================================== def fleur(x, y): cercle_centre(x - 8, y, 6, "pink") cercle_centre(x + 8, y, 6, "pink") cercle_centre(x, y + 8, 6, "pink") cercle_centre(x, y - 8, 6, "pink") cercle_centre(x, y, 5, "yellow") t.color("green") t.pensize(2) t.penup() t.goto(x, y - 5) t.pendown() t.goto(x, y - 35) # ===================================================== # OISEAU # ===================================================== def oiseau(x, y): t.color("black") t.pensize(2) t.penup() t.goto(x, y) t.setheading(45) t.pendown() t.circle(20, 90) t.penup() t.goto(x + 28, y) t.setheading(135) t.pendown() t.circle(20, 90) # ===================================================== # FEU TRICOLORE # ===================================================== def feu_tricolore(x, y): rectangle(x, y, 15, 120, "black") rectangle(x - 20, y + 120, 55, 100, "black") cercle_centre(x + 7, y + 195, 10, "red") cercle_centre(x + 7, y + 165, 10, "yellow") cercle_centre(x + 7, y + 135, 10, "green") # ===================================================== # DECOR # ===================================================== # sol rectangle(-600, -200, 1200, 400, "lightgreen") # route rectangle(-600, -320, 1200, 120, "gray") # marquage route for x in range(-550, 600, 120): rectangle(x, -265, 60, 8, "white") # soleil soleil(450, 280) # nuages nuage(-350, 250) nuage(-120, 300) nuage(150, 240) # maison maison(-500, -120) # arbre arbre(-180, -120) # immeuble immeuble(250, -120) # voiture voiture(-20, -240) # personnage personnage(180, -120) # feu tricolore feu_tricolore(450, -200) # fleurs fleur(-280, -140) fleur(-240, -150) fleur(-200, -135) fleur(-160, -145) # oiseaux oiseau(-100, 220) oiseau(20, 260) oiseau(120, 220) # ===================================================== turtle.done()