# pull.py

Created by schraf

Created on December 15, 2023

1.1 KB

```from kandinsky import fill_rect
from turtle import *

petitSapin = 0,0,1,3,5,7,3,5,7,1
grdSapin = 1,3,5,7,3,5,7,9,3,5,7,9,1
speed(0)

# couleurs et fond vert
BL = (255,) *3
NR = (0,) *3
fill_rect(0,0,320,222,(9,120,88))

def dessin(x,y,forme,coul):
for i,v in enumerate(forme):
fill_rect(x - v, y + i * 2, 2 * v, 2, coul)

def ligne(x,y,formes,espace,coul):
i = 0
while x < 320:
dessin(x,y,formes[i],coul[i])
i = (i + 1) % len(formes)
x += espace

def losanges(x,y):
carre = (1,3,5,3,1),(0,1,3,1,0)
ligne(x,y,carre,60,(NR,BL))
ligne(x+6,y+8,carre,60,(BL,NR))
ligne(x-6,y+8,carre,60,(BL,NR))
ligne(x,y+16,carre,60,(BL,NR))

def zigzag(y,coul):
x, h = -165, 30
penup()
goto(x,y + 24)
pendown()
pensize(3)
pencolor(coul)
while x < 160:
goto(x + 60, y - h)
x += 60
h = -h

# rangees de sapins
ligne(0,10,(petitSapin,grdSapin),30,(BL,NR))
ligne(0,115,(petitSapin,grdSapin),30,(NR,BL))

# rangees de losanges
for k in [-1,1]:
losanges(10 + 15 * k,63 + 15 * k)
losanges(10 + 15 * k,170 + 15 * k)

# les zigzags
for y in [48,43,-58,-63]: zigzag(y,(NR,BL)[y % 2])```