Tuesday, November 16, 2021

Draw peru flag in python turtle

 

Peru Flag
Peru Flag

About Flag:

the first flag of the Republic of Peru was created in 1820, whereas José American state San Martín arrived together with his navy of the mountain chain from Argentina and Chile. 

The Peruvian flag he designed alloyed the colors red and white, aforementioned to were hand-picked thanks to the very fact San Martín detected a flock of flamingos take to the air at his arrival. the shape of the flag became uncommon—a diagonal department forming white and pink triangles with a coat of hands inside the center. once native independence partisans connected themselves, another flag become adopted on March fifteen, 1822. 

The likeness of this flag (equal purple-white-purple horizontal stripes with a purple sun, the standard brand of the Inca empire, inside the center) thereto of Spain brought on confusion, and it turned into quickly altered (may in addition 31) to a flag with vertical stripes, however, the star complete remained within the center.

On Gregorian calendar month twenty-five, 1825, the layout currently in use turned into connected. The purple-white-purple vertical stripes from the previous flag had been preserved, however, the star become modified by employing a new coat of hands. Its shield is framed via one wreath (of palm and laurel branches) and head by the manner of each different. 

The defend is split into 3 components with figures symbolic of broad delight and wealth. The vicuña, an unfastened-roaming camelid closely related to the artiodactyl mammal and alpaca, is painted inside the primary quartering; additionally, to represent the material resource of Peruvian fauna, it stands for freedom, national pleasure, and valor. the second quartering incorporates cinchona, the bark that is accustomed to creating antimalarial. in the end, the rock bottom half of the shield shows a profuseness from that spill of gold and silver money, symbolic of the state’s mineral wealth. similarly, the white stripe of the flag is alleged to represent purity, and therefore the purple remembers the blood of patriots. 

As in several totally different international locations, the civil flag is flown by suggests that private voters display only the stripes, the coat of arms being reserved for flags serving reliable authorities functions.

Code:

# Draw Peru flag in turtle
from turtle import *

bgcolor('black')
hideturtle()  # for hiding turtle icon
speed(5)  # to increasing the speed of output

height = 200  # flag height
width = 3*height/2  # flag width

x_pos = -width/2  # initial x position
y_pos = height/2  # initial y position

penup()  # turtle pointer up
colormode(255)

def draw_rect(x_pos, y_pos, height, width):
    goto(x_pos, y_pos)  # changing the position of the turtle pointer
    pencolor(200, 16, 46)  # changing the pen color
    fillcolor(200, 16, 46)  # filling the color
    pendown()  # turtle pointer down
    begin_fill()  # beginning the filling
    for i in range(2):
        forward(width)  # Forward turtle by width units
        right(90)  # Turn right turtle by 90 degree
        forward(height)  # Forward turtle by height units
        right(90)  # Turn right turtle by 90 degree
    end_fill()  # ending the filling
    penup()  # turtle pointer up
# end def

def draw_stripe(x_pos, y_pos, height, width):
    goto(x_pos/3, y_pos)  # changing the position of the turtle pointer
    pencolor(255, 255, 255)  # changing the pen color
    fillcolor(255, 255, 255)  # filling the color
    pendown()  # turtle pointer down
    begin_fill()  # beginning the filling
    for i in range(2):
        forward(width/3)  # Forward turtle by width/3 units
        right(90)  # Turn right turtle by 90 degree
        forward(height)  # Forward turtle by height units
        right(90)  # Turn right turtle by 90 degree
    end_fill()  # ending the filling
    penup()  # turtle pointer up
# end def

draw_rect(x_pos, y_pos, height, width)
draw_stripe(x_pos, y_pos, height, width)

# It will keep output to wait for the click,
# Otherwise the output will disappear.
exitonclick()

Output:

Peru Flag Output

No comments:

Post a Comment

Draw bahamas flag in python turtle

  Bahamas Flag