Wish Merry Christmas Using Python Turtle

Last Updated : 24 Dec, 2025

Python's turtle module is a simple yet powerful way to create graphics using code. In this article, we demonstrate how to draw a Christmas tree, display a "Merry Christmas" greeting, and animate falling snow using Python Turtle graphics.

This example combines recursion, text rendering, and basic animation to create a festive scene.

Approach

  1. Set up the Turtle screen with background color and title
  2. Draw a Christmas tree using recursion
  3. Display a "Merry Christmas" message on the screen
  4. Create multiple snowflake objects
  5. Animate snowfall using an infinite loop

Complete Python Code

Python
import turtle
import random

# Screen setup
screen = turtle.Screen()
screen.setup(width=1.0, height=1.0)
screen.title("Merry Christmas - Python Turtle")
screen.bgcolor("midnight blue")

# Tree configuration
tree_length = 120
turtle.speed("fastest")
turtle.left(90)
turtle.penup()
turtle.backward(tree_length * 2)
turtle.pendown()
turtle.color("dark green")

# Draw Christmas tree using recursion
def draw_tree(depth, length):
    if depth == 0:
        return
    turtle.forward(length)
    turtle.left(30)
    draw_tree(depth - 1, length * 0.75)
    turtle.right(60)
    draw_tree(depth - 1, length * 0.75)
    turtle.left(30)
    turtle.backward(length)

draw_tree(10, tree_length)

# Write greeting text
pen = turtle.Turtle()
pen.hideturtle()
pen.penup()
pen.color("gold")
pen.goto(-250, -250)
pen.write(
    "Merry Christmas!",
    font=("Arial", 36, "bold")
)

# Snowflake setup
snowflakes = []

def create_snow():
    for _ in range(40):
        snow = turtle.Turtle()
        snow.hideturtle()
        snow.penup()
        snow.color("white")
        snow.shape("circle")
        snow.goto(
            random.randint(-400, 400),
            random.randint(-300, 300)
        )
        snowflakes.append(snow)

def snowfall():
    for snow in snowflakes:
        snow.goto(
            random.randint(-400, 400),
            random.randint(-300, 300)
        )
        snow.dot(6)

create_snow()

# Animate snowfall
while True:
    snowfall()

Output:

merry-christmas
Turtle Output

Explanation:

  • turtle.Screen() initializes the drawing window, while setup() and bgcolor() configure the screen size and background.
  • turtle.left(), penup(), backward(), and pendown() position the turtle at the base of the tree.
  • draw_tree() uses recursion to draw branches, where depth controls tree complexity and length reduces at each level.
  • turtle.forward(), left(), and right() create symmetrical tree branches.
  • A separate turtle (pen) is used with write() to display the Merry Christmas greeting.
  • create_snow() generates multiple snowflake turtles at random positions using random.randint().
  • snowfall() repositions snowflakes and draws dots to simulate falling snow.
  • while True: keeps the snowfall animation running continuously.
Comment
Article Tags:

Explore