Subscribe Us

Header Ads

How To Create Indian Flag using Python with Turtle module | Python Projects |

Hey Guys in This Post i am gonna tell you How you can create indian Flag Using Python with Turtle module....

Source Code...

# required module-pip install turtle
import turtle

# inializing a turtle
flag = turtle.Turtle()


# for creating first reactangle
flag.begin_fill()
flag.fillcolor("orange")
flag.forward(80)
flag.right(90)
flag.forward(17)
flag.right(90)
flag.forward(80)
flag.right(90)
flag.forward(17)
flag.right(90)
flag.end_fill()


# for second rectangle
flag.right(90)
flag.forward(34)
flag.left(90)
flag.forward(80)
flag.left(90)
flag.forward(17)
flag.left(90)
flag.forward(80)


# for third rectangle
flag.begin_fill()
flag.fillcolor("green")
flag.left(90)
flag.forward(34)
flag.left(90)
flag.forward(80)
flag.left(90)
flag.forward(17)
flag.left(90)
flag.forward(80)

flag.end_fill()


# for creating pipe of flag
flag.left(90)
flag.forward(150)


# for creating downstairs
flag.begin_fill()
flag.fillcolor("black")
flag.left(90)
flag.forward(90)
flag.left(180)
flag.forward(180)
flag.left(90)
flag.forward(40)
flag.left(90)
flag.forward(180)
flag.left(90)
flag.forward(40)
flag.end_fill()


# for creating rope of flag

flag.left(90)
flag.forward(90)
flag.right(30)
flag.forward(30)
flag.right(120)
flag.forward(60)
flag.left(120)
flag.forward(60)
flag.right(120)
flag.forward(60)
flag.left(102)
flag.forward(48)

# for creating Ashok chakra
flag.penup()
flag.goto(52, -20)
flag.pendown()
flag.begin_fill()
flag.fillcolor("blue")
flag.circle(9)
flag.end_fill()




Post a Comment

0 Comments