Create Indian flag using Turtle

Create Indian flag using Turtle Python

Hey everybody, In this post you will be learning how to create Indian flag using Turtle Library of Python.

Create Indian flag using Turtle


Source Code 

  
    import turtle
from turtle import*

#screen for output
screen = turtle.Screen()

# definiing a turtle instance
t = turtle.Turtle()
speed(0)

# initially penup()
t.penup()
t.goto(-400, 250)
t.pendown()

# orange rectangle
# whit rectangle
t.color("orange")
t.begin_fill()
t.forward(800)
t.right(90)
t.forward(167)
t.right(90)
t.forward(800)
t.end_fill()
t.left(90)
t.forward(167)

# green rectangle
t.color("green")
t.begin_fill()
t.forward(167)
t.left(90)
t.forward(800)
t.left(90)
t.forward(167)
t.end_fill()

# big blue circle
t.penup()
t.goto(70, 0)
t.pendown()
t.color("navy")
t.begin_fill()
t.circle(70)
t.end_fill()

# big white circle
t.penup()
t.goto(60, 0)
t.pendown()
t.color("white")
t.begin_fill()
t.circle(60)
t.end_fill()

# Mini blue circles
t.penup()
t.goto(-57, -8)
t.pendown()
t.color("navy")
for i in range(24):
t.begin_fill()
t.circle(3)
t.end_fill()
t.penup()
t.forward(15)
t.right(15)
t.pendown()

# small blue circle
t.penup()
t.goto(20, 0)
t.pendown()
t.begin_fill()
t.circle(20)
t.end_fill()
#spokes
t.penup()
t.goto(0, 0)
t.pendown()
t.pensize(2)
for i in range(24):
t.forward(60)
t.backward(60)
t.left(15)

#to hold the
#output window
turtle.done()
# And the flag is ready.....


If you like the content kindly share it and appreciate in comments. Also, suggestions for improvement are welcomed always.


1 Comments

For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.

  1. Thanks for your information but my brother know this already

    ReplyDelete

Post a Comment

For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.

Post a Comment

Previous Post Next Post