Morceau de participation pour le Concours de Noël 2020 organisé par Casio.
from turtle import * hideturtle() penup() pencolor((120,60,0)) pensize(3) goto(-80,0) pendown() rt(35) for i in range(45): fd(1) rt(1) rt(90) #bois pensize(3) pencolor((120,60,0)) for i in range(30): fd(2) lt(6) rt(10) fd(10) lt(90) for i in range(4): fd(20) rt(90) fd(7) rt(90) fd(20) lt(90) fd(40) lt(90) rt(90) for i in range(10): fd(1.2) rt(18) fd(47*4+10) for i in range(28): fd(2.9) rt(6) rt(84) for i in range(20): fd(1) rt(1) fd(7) setheading(0) fd(180) #arrière lt(90) for i in range(30): fd(3) rt(i//10) setheading(0) for i in range(17): fd(1) lt(10) fd(3) penup() fd(-3) for i in range(17): fd(-1) lt(-10) pendown() setheading(160) for i in range(38): fd(6) lt((15-i)/2) for i in range(40): fd(1) lt((15-i)) penup() setheading(0) fd(210) lt(90) fd(40) pendown() setheading(160) for i in range(38): fd(6) lt((15-i)/2) for i in range(42): fd(1) lt((15-i)) lt(70) fd(15) #paquets from random import randint for coord in [(20,30),(-20,-10),(-60,10),(60,30)]: penup() goto(coord[0],coord[1]) pendown() pensize(7) pencolor((255*randint(1,10)/10,255*randint(1,10)/10,255*randint(1,10)/10)) setheading(randint(1,60)-30) for i in range(4): fd(40) lt(90) fd(40) lt(45) fd(15) lt(45) fd(40) lt(135) fd(15) fd(-15) rt(45) fd(40) lt(45) fd(15) penup() lt(45) pencolor((255*randint(1,10)/10,255*randint(1,10)/10,255*randint(1,10)/10)) pensize(7) fd(20) #pendown() lt(90) fd(40) lt(45) fd(15) fd(-7) pendown() pensize(5) lt(45) fd(-20) fd(40) lt(90) fd(40) fd(-40) rt(90) fd(-20) rt(45) pensize(7) penup() fd(-8) rt(45) fd(-20) pendown() lt(90) fd(-20) fd(40) #ruban rt(45) fd(7) rt(15) for j in range(2): for i in range(30): fd(1) lt(2) lt(120) for i in range(30): fd(1) lt(2) rt(180)