Loading design...

A beautiful snowfall simulation created with Python Turtle. Read the code below, copy it, and try it in your own Python environment.
import random
from turtle import *
setup(width=800, height=600)
bgcolor("#001a33")
tracer(0)
snowfs = []
for _ in range(100):
f = Turtle()
f.shape("circle")
f.color("white")
f.penup()
size = random.uniform(0.1, 0.6)
f.shapesize(stretch_wid=size,
stretch_len=size)
f.goto(random.randint(-380, 380)
, random.randint(100, 300))
f.fall_speed = random.uniform(
0.5, 2.5)
snowfs.append(f)
def move_snowfs():
for f in snowfs:
f.sety(f.ycor() - f.fall_speed)
f.setx(f.xcor() + random.uniform(
-0.5, 0.5))
if f.ycor() < -300:
f.goto(random.randint(-380,
380),
300)
update()
ontimer(move_snowfs, 20)
move_snowfs()
done()