Ad Code

Indian Flag With Single Quote Line Using Python (Turtle).


 Indian Flag With Single Quote Line

Welcome to Codingfizz,


In this tutorial, we will make an Indian flag using turtle in python. And Write a single line with the flag, i.e. "We are Indians".

it's a short graphic program in the turtle. You can increase your knowledge to make some interesting programs using python. 

 What is Turtle?


Turtle is pre-install python library. Its used for creating and drawing shapes and picture with virtual canvas. Turtle is simple to use and useful.

We will import turtle and use some functions of the turtle.

Source Code:

 
 import turtle
 from turtle import*

 #screen for output
 screen = turtle.Screen()

 # Defining a turtle Instance
 t = turtle.Turtle()
speed(10)

 # write text
 # styling font
 t.write("'We are Indians'",
 font=("Verdana", 25, "bold"),
 align="center")

 t.hideturtle()

 # initially penup()
 t.penup()
 t.goto(-230, -40)
 t.pendown()


  
  

     
  
  
 # Orange Rectangle
 #white rectangle
 t.color("orange")
 t.begin_fill()
 t.forward(450)
 t.right(90)
 t.forward(90)
 t.right(90)
 t.forward(450)
 t.end_fill()

  
  

     
  
  
 t.left(90)
 t.forward(90)

 # Green Rectangle
 t.color("green")
 t.begin_fill()
 t.forward(90)
 t.left(90)
 t.forward(450)
 t.left(90)
 t.forward(90)
 t.end_fill()

 # Big Blue Circle
 t.penup()
 t.goto(45, -175)
 t.pendown()
 t.color("navy")
 t.begin_fill()
 t.circle(40)
 t.end_fill()

 # Big White Circle
 t.penup()
 t.goto(40, -175)
 t.pendown()
 t.color("white")
 t.begin_fill()
 t.circle(35)
 t.end_fill()

 # Spokes
 t.penup()
 t.goto(5, -175)
 t.pendown()
 t.pensize(2)
 t.color("navy")
 for i in range(24):
    t.forward(35)
    t.backward(35)
    t.left(15)
    
 turtle.done()

Output:


Post a Comment

0 Comments

Ad Code