Draw a Boat using Python in Hindi

Hello dosto! Meri website programmingkakeeda.com me apka welcome hai, aaj ka humara topic python turtle library ka use karke ek simple si boat banana hai, bahut hi simple topic-Draw a Boat using Python.
Draw a Boat using Python

Draw a Boat using Python in Hindi

Hum step by step code ko samjhnge:

Import Turtle

from turtle import *
title('Draw a Boat using Python')
bgcolor("#6495ED")

Import wah function he jo un module ka use karta he jinko hum apne projects me use karte hai, isliye humne boat draw karne k liye turtle module ka use kiya he, jo drawing banane k liye use kiya jata hai. Humne screen ka background color cornflowerblue set kiya hai.

Python Turtle function ka use karke ek boat ka drawing banaye

color("#966919","#5C4033")
penup()
goto(60,-150)
begin_fill()
pendown()
forward(200)
left(60)
forward(80)
setheading(180)
forward(280)
left(120)
forward(80)
end_fill()
backward(80)
setheading(0)
forward(140)
left(90)

Humne pen ka color Dark orange [Brown tone] aur boat ka color very dark Brown set kiya hai, humne turtle ki position ki goto(60, -150) par set kiya hai ye humari boat ki starting position hai, turtle ko aage badhane ke liye forward() function use kiya hai, left() aur right() turtle ka angle provide karta he, setheading() function turtle k points ki direction set karta hai.

Boat ki stick draw karna

pensize(9)
forward(125)
backward(5)
penup()

Yaha humne boat ke upar ek stick draw karne k liye pensize 9 rakha hai.

Boat ke wings draw karna

#draw left wing
pensize(2)
pendown()
left(130)
forward(4)
color("#FFEFD5")
begin_fill()
forward(165)
setheading(0)
forward(125)
end_fill()
penup()
left(90)
forward(108)
right(90)
forward(7)

#draw right wing
pensize(2)
pendown()
right(40)
color("#FFDAB9")
begin_fill()
forward(168)
setheading(180)
forward(125)
end_fill()
penup()

Boat k andar ke 3no circle draw karna

color("black","#FFE4B5")
goto(100,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()
goto(160,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()
goto(220,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()

Code ke is part me humne boat ke 3no circle banaye hai, goto() function ki help se humne position set ki hai, humne circle ki radius 11 rakhi hai, penup() function ka use tab kiya jata hai jab hum screen par kuch bhi nhi draw kar rahe ho, aur pendown() function ka use drawing ko fir se suru karne ke liye kiya jata hai.

Sun aur sunrays draw karna

color("#FF5F1F","#FF5F1F")
goto(-200,200)
pendown()
begin_fill()
circle(35)
end_fill()
penup()

#sunrays
pensize(5)
goto(-200,170)
for i in range(12):
    pendown()
    backward(80)
    forward(80)
    left(30)
penup()

Yaha humne sun ko draw kiya hai, jiska radius 35 hai, jiski position goto(-200, 200) par set hai, humne sun ki sunrays ko banane k liye loop ka use kiya hai.

Pani ko draw karna

goto(-800,-150)
setheading(0)
color("#87CEEB","#87CEEB")
pendown()
begin_fill()
forward(1500)
right(90)
forward(180)
right(90)
forward(1400)
end_fill()
done()

Yah code boat ke pani ko draw karne ka hai, aur done() function ka use drawing window ko rokne aur program khatam ho gaya hai ye batata hai.

Complete code-Draw a Boat using Python

from turtle import *
title('Draw a Boat using Python')
bgcolor("#6495ED")

#Draw boat
color("#966919","#5C4033")
penup()
goto(60,-150)
begin_fill()
pendown()
forward(200)
left(60)
forward(80)
setheading(180)
forward(280)
left(120)
forward(80)
end_fill()
backward(80)
setheading(0)
forward(140)
left(90)

#Draw the stick
pensize(9)
forward(125)
backward(5)
penup()

#draw left wing
pensize(2)
pendown()
left(130)
forward(4)
color("#FFEFD5")
begin_fill()
forward(165)
setheading(0)
forward(125)
end_fill()
penup()
left(90)
forward(108)
right(90)
forward(7)

#draw right wing
pensize(2)
pendown()
right(40)
color("#FFDAB9")
begin_fill()
forward(168)
setheading(180)
forward(125)
end_fill()
penup()

#Draw the three small circles
color("black","#FFE4B5")
goto(100,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()
goto(160,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()
goto(220,-100)
pendown()
begin_fill()
circle(11)
end_fill()
penup()

#draw the circle of the sun
color("#FF5F1F","#FF5F1F")
goto(-200,200)
pendown()
begin_fill()
circle(35)
end_fill()
penup()

#sunrays
pensize(5)
goto(-200,170)
for i in range(12):
    pendown()
    backward(80)
    forward(80)
    left(30)
penup()

#Draw the water
goto(-800,-150)
setheading(0)
color("#87CEEB","#87CEEB")
pendown()
begin_fill()
forward(1500)
right(90)
forward(180)
right(90)
forward(1400)
end_fill()
done()
Output:-
Draw a Boat using Python

Humare Website me aane ke liye apka bahut-bahut dhanyawaad!

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

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