Introduction
In this post, we’ll look at how to design a Snowman using Python Turtle. The snowman is made up of various-sized round snowballs.
A snowman is made out of various-sized circular snowballs. The snowman’s body is made up of three snowballs stacked on top of each other. The eyes, nose, and buttons are all circular. We shall sketch a snowman while keeping this in mind.
Let’s Code Now
Import the turtle library
import turtle
First of all, we must import the turtle package using the import method. It has a variety of functions and features. It enables us to draw anything with the help of a Python turtle.
We need to set the screen(), turtle speed, and background-color
turtle.speed(4)
turtle.setup(800, 700)
turtle.bgcolor("black")
Here, we set the cursor speed (4), set up the screen size(800 x 700), and set up the background color to black.
Creating a circle behind the Snowman
turtle.penup()
turtle.goto(0, -320)
turtle.pendown()
turtle.color("#c1f8b5")
turtle.begin_fill()
turtle.circle(320)
turtle.end_fill()
First of all, we use the penup function to move the pen and set the pen coordinates to (0, -320), we use the pen down function to draw a circle size of 320 and set the circle color.
Drawing the Bottom circle of Snowman using Python Turtle
# Bottom of body
turtle.penup()
turtle.goto(0, -280)
turtle.pendown()
turtle.color("white")
turtle.begin_fill()
turtle.circle(110)
turtle.end_fill()
In this part, we are drawing the bottom circle for we use the goto function to shift the location to (0,-280). And use the pen down function and circle function to draw the circle. here we use the begin_fill() function which is used to fill the white color in the circle. And use end_fill() to close the function.
Drawing the Middle of the Body
turtle.penup()
turtle.goto(0, -110)
turtle.pendown()
turtle.begin_fill()
turtle.circle(90)
turtle.end_fill()
Here we draw the middle circle of snowmen, with the help of the turtle function. But first, we goto to the location (0,-100) to draw the circle.
Drawing Head of Snowman
turtle.penup()
turtle.goto(0, 20)
turtle.pendown()
turtle.begin_fill()
turtle.circle(70)
turtle.end_fill()
To draw ahead of Snowman we have to change the pen location to (0,20).
Creating a function to Draw Black Circle
def black_circle():
turtle.color("black")
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
Here we created a black_circle() function, so we don’t have to write a single code multiple times. To draw multiple black circles for the eyes and Buttons of Snowman
Draw the eyes of Snowman
# Eyes
x = -20
for i in range(2):
turtle.penup()
turtle.goto(x, 110)
turtle.pendown()
black_circle()
x = x + 40
We take a variable x = -20 which is used to set the coordinate of the goto function to place the eyes and using the black_circle() function we can draw the eyes and use x = x + 40 to draw the second eye of a snowman.
Draw Buttons of Snowman
# Buttons
y = 0
for i in range(5):
turtle.penup()
turtle.goto(0, y)
turtle.pendown()
black_circle()
y = y – 55
Here we use y = 0 which is used to set the coordinate of the goto function to place the buttons and use of the black_circle() function we can draw the buttons and use y = y – 55 to draw the buttons of the snowman vertically.
Drawing the Mouth of SnowMan
# Mouth
turtle.penup()
turtle.goto(0,70)
turtle.pendown()
turtle.color("red")
turtle.begin_fill()
turtle.circle(17)
turtle.end_fill()
turtle.penup()
turtle.goto(0,75)
turtle.pendown()
turtle.color("white")
turtle.begin_fill()
turtle.circle(17)
turtle.end_fill()
There is not a particular shape to draw a mouth so here we use to circle where one circle is red and the other one is white. These two circles are overlapped so we create a mouth.
Drawing Right Arm of Snowman using Python Turtle
# Right Arm
turtle.penup()
turtle.goto(75, 0)
turtle.pendown()
turtle.color("brown")
turtle.begin_fill()
turtle.left(40)
for i in range(2):
turtle.forward(75)
turtle.left(90)
turtle.forward(7)
turtle.left(90)
turtle.end_fill()
# Right Finger 1
turtle.penup()
turtle.goto(115, 38)
turtle.pendown()
turtle.begin_fill()
turtle.left(40)
for i in range(2):
turtle.forward(25)
turtle.left(90)
turtle.forward(5)
turtle.left(90)
turtle.end_fill()
# Right Finger 2
turtle.begin_fill()
turtle.right(100)
for i in range(2):
turtle.forward(25)
turtle.left(90)
turtle.forward(5)
turtle.left(90)
turtle.end_fill()
To draw a right arm we need to draw 3 lines, so the pen move to location (75, 0), and we use the left function to forward function appropriately to draw the hand.
Drawing Left hand
# Left Arm
turtle.penup()
turtle.goto(-130, 50)
turtle.pendown()
turtle.begin_fill()
turtle.right(10)
for i in range(2):
turtle.forward(75)
turtle.right(90)
turtle.forward(7)
turtle.right(90)
turtle.end_fill()
# Left Finger 1
turtle.penup()
turtle.goto(-112, 58)
turtle.pendown()
turtle.begin_fill()
turtle.right(40)
for i in range(2):
turtle.forward(25)
turtle.right(90)
turtle.forward(5)
turtle.right(90)
turtle.end_fill()
# Left Finger 2
turtle.begin_fill()
turtle.right(100)
turtle.penup()
turtle.goto(-108, 31)
turtle.pendown()
for i in range(2):
turtle.forward(25)
turtle.right(90)
turtle.forward(5)
turtle.right(90)
turtle.end_fill()
As we showed for the Right Arm, To draw a Left Arm we need to draw 3 lines, and use the left() forward functions appropriately to draw the hand.
Drawing the Hat of Snowman
# Left Arm
turtle.penup()
turtle.goto(-130, 50)
turtle.pendown()
turtle.begin_fill()
turtle.right(10)
for i in range(2):
turtle.forward(75)
turtle.right(90)
turtle.forward(7)
turtle.right(90)
turtle.end_fill()
# Left Finger 1
turtle.penup()
turtle.goto(-112, 58)
turtle.pendown()
turtle.begin_fill()
turtle.right(40)
for i in range(2):
turtle.forward(25)
turtle.right(90)
turtle.forward(5)
turtle.right(90)
turtle.end_fill()
# Left Finger 2
turtle.begin_fill()
turtle.right(100)
turtle.penup()
turtle.goto(-108, 31)
turtle.pendown()
for i in range(2):
turtle.forward(25)
turtle.right(90)
turtle.forward(5)
turtle.right(90)
turtle.end_fill()
Complete code to Snowman using Python Turtle
import turtle turtle.speed(2) turtle.setup(800, 700) turtle.bgcolor("black") # Blue Background turtle.penup() turtle.goto(0, -320) turtle.pendown() turtle.color("#c1f8b5") turtle.begin_fill() turtle.circle(320) turtle.end_fill() # Bottom of body turtle.penup() turtle.goto(0, -280) turtle.pendown() turtle.color("white") turtle.begin_fill() turtle.circle(110) turtle.end_fill() # Middle of body turtle.penup() turtle.goto(0, -110) turtle.pendown() turtle.begin_fill() turtle.circle(90) turtle.end_fill() # Head of Snowman turtle.penup() turtle.goto(0, 20) turtle.pendown() turtle.begin_fill() turtle.circle(70) turtle.end_fill() # Function to draw 1 small black circle def black_circle(): turtle.color("black") turtle.begin_fill() turtle.circle(10) turtle.end_fill() # Eyes x = -20 for i in range(2): turtle.penup() turtle.goto(x, 110) turtle.pendown() black_circle() x = x + 40 # Buttons y = 0 for i in range(5): turtle.penup() turtle.goto(0, y) turtle.pendown() black_circle() y = y - 55 # Mouth turtle.penup() turtle.goto(0,70) turtle.pendown() turtle.color("red") turtle.begin_fill() turtle.circle(17) turtle.end_fill() turtle.penup() turtle.goto(0,75) turtle.pendown() turtle.color("white") turtle.begin_fill() turtle.circle(17) turtle.end_fill() # Right Arm turtle.penup() turtle.goto(75, 0) turtle.pendown() turtle.color("brown") turtle.begin_fill() turtle.left(40) for i in range(2): turtle.forward(75) turtle.left(90) turtle.forward(7) turtle.left(90) turtle.end_fill() # Right Finger 1 turtle.penup() turtle.goto(115, 38) turtle.pendown() turtle.begin_fill() turtle.left(40) for i in range(2): turtle.forward(25) turtle.left(90) turtle.forward(5) turtle.left(90) turtle.end_fill() # Right Finger 2 turtle.begin_fill() turtle.right(100) for i in range(2): turtle.forward(25) turtle.left(90) turtle.forward(5) turtle.left(90) turtle.end_fill() # Left Arm turtle.penup() turtle.goto(-130, 50) turtle.pendown() turtle.begin_fill() turtle.right(10) for i in range(2): turtle.forward(75) turtle.right(90) turtle.forward(7) turtle.right(90) turtle.end_fill() # Left Finger 1 turtle.penup() turtle.goto(-112, 58) turtle.pendown() turtle.begin_fill() turtle.right(40) for i in range(2): turtle.forward(25) turtle.right(90) turtle.forward(5) turtle.right(90) turtle.end_fill() # Left Finger 2 turtle.begin_fill() turtle.right(100) turtle.penup() turtle.goto(-108, 31) turtle.pendown() for i in range(2): turtle.forward(25) turtle.right(90) turtle.forward(5) turtle.right(90) turtle.end_fill() # Hat turtle.penup() turtle.goto(50, 150) turtle.pendown() turtle.color("black") turtle.begin_fill() turtle.right(10) turtle.forward(100) turtle.right(90) turtle.forward(10) turtle.right(90) turtle.forward(20) turtle.left(90) turtle.forward(45) turtle.right(90) turtle.forward(60) turtle.right(90) turtle.forward(45) turtle.left(90) turtle.forward(20) turtle.right(90) turtle.end_fill() # Text on Screen turtle.penup() turtle.goto(130, -230) turtle.pendown() turtle.color("red") turtle.write("Vatsal Rakholiya", font=("Arial", 20, "bold")) turtle.hideturtle()
Output :
Thanks For Reading our article, Also comment to us about how you like the article. And for more turtle tutorials please visit violet-cat-415996.hostingersite.com.
Also Read:
- Simple Code to compare Speed of Python, Java, and C++?
- Falling Stars Animation on Python.Hub October 2024
- Most Underrated Database Trick | Life-Saving SQL Command
- Python List Methods
- Top 5 Free HTML Resume Templates in 2024 | With Source Code
- How to See Connected Wi-Fi Passwords in Windows?
- 2023 Merry Christmas using Python Turtle
- 23 AI Tools You Won’t Believe are Free
- Python 3.12.1 is Now Available
- Best Deepfake Apps and Websites You Can Try for Fun
- Amazon launched free Prompt Engineering course: Enroll Now
- 10 GitHub Repositories to Master Machine Learning
- Hello World in 35 Programming Languages
- How to Scrape Data From Any Website with Python?
- Become Job Ready With Free Harvard Computer Science course: Enroll Now
- Free Python Certification course from Alison: Good for Resume
- Download 1000+ Projects, All B.Tech & Programming Notes, Job, Resume & Interview Guide, and More – Get Your Ultimate Programming Bundle!
- Udacity Giving Free Python Course: Here is how to Enroll
- Love Babbar’s Income Revealed
- Top 5 Websites to Learn Programming in 2024
- Python Internship for college students and freshers: Apply Here
- Microsoft Giving Free Python Course in 2023: Enroll Now
- Top 5 Free Python Courses on YouTube in 2024
- Complete Python Roadmap for Beginners in 2024
- New secrets to Earn money with Python in 2024
- Connect with HR Directly – Job Hack
- Google offering free Python course: Enroll Today
- What is an AI Tool?
- Google Internship 2024
- TCS Launched Free Certification Course with Industry Recognized Value