Morceau de participation pour le Concours de Noël 2020 organisé par Casio.
from turtle import * setheading(-30) penup() goto(-0,-70) hideturtle() #pendown() pencolor((0,205,0)) pensize(2) for k in [-1,1]: penup() goto(0,-70) setheading(90) fd(15) setheading(90-120*k) fd(16) pendown() for j in range(4): for i in range(30): fd(1-j/5) lt(k*(1+i//20)) rt(50*k) for i in range(10): fd(-1+j/5) lt(k*(-1-i//20)) lt(50*k) for i in range(50): fd(1-j/5) lt(k*(i/30)) rt(40*k) for i in range(40): fd(-1+j/5) lt(k*(-i//20)) lt(70*k) for i in range(10): fd(1-j/5) lt(k*(1+i//20)) rt(30*k) for i in range(40): fd(-1+j/5) lt(k*(-1-i//30)) setheading(90-90*k-30*k+30*j*k) setheading(90-50*k) for i in range(30): fd(1/2) lt(k*(1+i//20)) rt(40*k) for i in range(20): fd(-1/3) lt(k*(-1-i//20)) lt(50*k) for i in range(30): fd(1/2) lt(k*(i/10)) rt(60*k) for i in range(30): fd(-1/3) lt(k*(i/20)) lt(20*k) for i in range(30): fd(1/2) lt(k*(1+i//20)) #guirlandes penup() goto(10,60) pendown() pencolor((255,0,0)) setheading(-140) for i in range(6): pensize(5) fd(3) pensize(2) fd(3) rt(5) setheading(-50) for i in range(10): pensize(5) fd(3) pensize(2) fd(3) lt(6) setheading(-150) for i in range(12): pensize(5) fd(3) pensize(2) fd(3) rt(4) setheading(-60) for i in range(13): pensize(5) fd(3) pensize(2) fd(3) lt(6) setheading(-120) for i in range(15): pensize(5) fd(3) pensize(2) fd(3) rt(6) setheading(-50) for i in range(13): pensize(5) fd(3) pensize(2) fd(3) lt(6) #boules from random import randint for coord in [(17,32),(-17,24),(-60,-10),(15,0),(-30,-40),(40,-50)]: penup() goto(coord[0],coord[1]) pensize(12) pencolor((255*randint(1,10)/10,255*randint(1,10)/10,255*randint(1,10)/10)) pendown() fd(1) #etoile penup() goto(-10,90) pendown() pencolor((220,220,40)) pensize(5) setheading(0) for i in range(5): fd(20) rt(72*2)