christmas3.py

Created by schraf

Created on December 02, 2022

471 Bytes


from turtle import *
from kandinsky import fill_rect

def T(u,a1,a2,b1,b2):
    return int((b2-b1)/(a2-a1)*(u-a1)+b1)

fill_rect(0,0,320,222,(230,)*3)
color(30,140,0)
xd = -75
while xd < 75:
 h = 80-9*abs(xd)/4
 penup()
 x,y = xd,-100
 goto(x,y)
 pendown()
 a = T(abs(x),0,75,90,75)
 if x > 0: a = 180-a
 setheading(a)
 while y < h:
  pensize(T(y,-100,h,7,1))
  fd(1)
  (x,y) = position()
 xd += 5
penup()
goto(0,90)
fill_rect(150,210,20,10,(30,140,0))