Snowman Drawing Using Python Turtle Graphics

Python mein bahut se module hain jo graphical chitran darshate hain, unme se ek turtle hai, yah python mein ek in-built module hai, jo upayogakarta ko screen(drawing board) par chitra(Snowman Drawing) banane ke liye ek pen(turtle) ko niyantrit karne deta hai. Iska upayog jyadatar Drawing,Shapes,Designs etc, ko chitrit karne ke liye kiya jata hai.

Snowman Drawing Using Python Turtle Graphics
Is article mein, hum sikhenge ki turtle module ka upayog karke ek snowman ko kaise chitrit kiya jaye(Snowman Drawing Using Python Turtle Graphics). Snowman mein vibhin aakaron ke circular shapes ke snowballs hote hain. Snowman ki body ek ke upar ek rakhe gaye 2 snowball se bana hai aur aankhen aur button bhi circular shapes ki hain.

Snowman Drawing Using Python Turtle Graphics

Let’s Code Now

Import the turtle library

from turtle import *
Sabse pehle, hume turtle method ka upayog karke turtle package ko import karna hoga. Isme alag-alag prakar ke functions aur features hain. Yah hume python turtle ki madat se kuch bhi draw karne me help karta hai.

We need to set the screen(), turtle speed, and background-color

bgcolor("blue")
title("Programming ka keeda")
speed(2)
Yahan, hum cursor ki speed(2) set karte hain, screen ka size default rakte hain, aur background ka color blue set karte hain.

Draw Snow box

# Snow Box
for i in range(4):
    color("white","#fffff0")
    
pensize(10)    
forward(400)
left(90)
begin_fill()
forward(400)
left(90)
forward(100)
left(90)
forward(400)
left(90)
forward(100)
end_fill()

Draw a first big circle

# First Circle
left(180)
forward(100)
right(90)
forward(200)
begin_fill()
circle(75)
end_fill()
Sabse pehle, hum pen ko set karne ke liye alag-alag function ka upayog karte hain aur hum 75 size ka ek circle aakar draw karne aur circle ka color set karne ke liye hum begin_fill aur end_fill function ka upayog karte hain.

Drawing the second circle of Snowman using Python Turtle

# Second Circle
color('black')
penup()
left(90)
forward(75)
forward(75)
right(90)
pendown()
color("white","#fffff0")
begin_fill()
circle(40)
end_fill()
Is bhaag mein, hum pen ki position set karne k liye (left, right, forward) function ka upayog karte hai aur circle draw karne ke liye pen down function aur circle function ka upayog karte hai. Yahan hum begin_fill() function ka upayog karte hain jiska upayog circle me white color bharne ke liye kiya jata hai, aur function ko band karne ke liye end_fill() ka upayog kiya jata hai.

Draw left and right hand

# Left Hand
color("brown")
pensize(10)
penup()
right(90)
forward(10)
forward(20)
left(90)
forward(55)
forward(10)
forward(1)
left(45)
pendown()
forward(50)
right(35)
forward(20)
backward(20)
left(35)
backward(10)
left(35)
forward(10)
forward(10)
forward(10)
forward(5)
forward(5)

# Right Hand
penup()
backward(20)
backward(10)
right(30)
right(5)
right(35)
right(90)
forward(100)
backward(50)
right(10)
right(90)
forward(180)
right(35)
pendown()
backward(5)
forward(50)
right(35)
forward(20)
backward(20)
left(35)
backward(20)
left(35)
forward(20)
forward(20)

Draw the eyes and lips

# Eyes and Lips
penup()
color("black")
setposition(0,0)
right(90)
forward(100)
forward(40)
backward(5)
setposition(10,-50)
forward(100)
left(90)
forward(20)
dot()
backward(40)
dot()
left(90)
forward(20)
forward(30)
backward(10)
right(90)
forward(3)
pendown()
pensize(3)
forward(35)
Eyes draw karne k liye hum dot() function ka use karenge.

Draw buttons of snowman

# Buttons
penup()
setposition(9,-50)
left(90)
pensize(5)
pensize(10)
forward(20)
forward(30)
backward(50)
backward(10)
pensize(6)
dot()
forward(30)
dot()
forward(30)
dot()
backward(60)
backward(30)
right(90)
right(90)
forward(10)
right(90)
backward(20)
pensize(10)
color("red")
pendown()
Buttons ko bhi draw karne k liye hum dot() function ka hi use karenge.

Draw scarf and cap

# scarf and cap
forward(50)
backward(50)
backward(5)
forward(10)
right(90)
forward(20)
penup()
color("red")
left(90)
forward(20)
left(90)
forward(90)
right(90)
pendown()
forward(40)
backward(85)
forward(10)
left(95)
color("red", "red")
begin_fill()
forward(20)
right(90)
forward(75)
right(90)
forward(50)
right(90)
end_fill()
penup()

Complete Code to Snowman Drawing Using Python Turtle

from turtle import*
bgcolor("blue")
title("Programming ka keeda")
speed(2)
penup()
goto(-190,150)
right(90)
pendown()

# snow box
for i in range(4):
    color("white","#fffff0")
    
pensize(10)    
forward(400)
left(90)
begin_fill()
forward(400)
left(90)
forward(100)
left(90)
forward(400)
left(90)
forward(100)
end_fill()

# first circle
left(180)
forward(100)
right(90)
forward(200)
begin_fill()
circle(75)
end_fill()

# Second Circle
color('black')
penup()
left(90)
forward(75)
forward(75)
right(90)
pendown()
color("white","#fffff0")
begin_fill()
circle(40)
end_fill()

# Left Hand
color("brown")
pensize(10)
penup()
right(90)
forward(10)
forward(20)
left(90)
forward(55)
forward(10)
forward(1)
left(45)
pendown()
forward(50)
right(35)
forward(20)
backward(20)
left(35)
backward(10)
left(35)
forward(10)
forward(10)
forward(10)
forward(5)
forward(5)

# Right Hand
penup()
backward(20)
backward(10)
right(30)
right(5)
right(35)
right(90)
forward(100)
backward(50)
right(10)
right(90)
forward(180)
right(35)
pendown()
backward(5)
forward(50)
right(35)
forward(20)
backward(20)
left(35)
backward(20)
left(35)
forward(20)
forward(20)

# Eyes and Lips
penup()
color("black")
setposition(0,0)
right(90)
forward(100)
forward(40)
backward(5)
setposition(10,-50)
forward(100)
left(90)
forward(20)
dot()
backward(40)
dot()
left(90)
forward(20)
forward(30)
backward(10)
right(90)
forward(3)
pendown()
pensize(3)
forward(35)

# buttons
penup()
setposition(9,-50)
left(90)
pensize(5)
pensize(10)
forward(20)
forward(30)
backward(50)
backward(10)
pensize(6)
dot()
forward(30)
dot()
forward(30)
dot()
backward(60)
backward(30)
right(90)
right(90)
forward(10)
right(90)
backward(20)
pensize(10)
color("red")
pendown()

# scarf and cap
forward(50)
backward(50)
backward(5)
forward(10)
right(90)
forward(20)
penup()
color("red")
left(90)
forward(20)
left(90)
forward(90)
right(90)
pendown()
forward(40)
backward(85)
forward(10)
left(95)
color("red", "red")
begin_fill()
forward(20)
right(90)
forward(75)
right(90)
forward(50)
right(90)
end_fill()
penup()
hideturtle()
done()

Output:-

Snowman Drawing Using Python Turtle Graphics
Video Link:- Click me

Humari Website Programming Ka Keeda me aane ke liye apka bahut-bahut dhanywaad! 😊

एक टिप्पणी भेजें

0 टिप्पणियाँ
* Please Don't Spam Here. All the Comments are Reviewed by Admin.