Wednesday, November 17, 2021

Draw bahamas flag in python turtle

 

Bahamas Flag
Bahamas Flag


About Flag:

Many of the world's best fleets are sailing under the Bahamas flag of choice due to its reputation for quality and excellence. Many of the biggest names in international shipping choose this flag as a first option because of its reputation for excellence.

A long-standing maritime nation in the Caribbean, The Bahamas understands shipowners' needs. The Bahamas Register's quality and reputation are known throughout the world, representing ship types and nations from around the globe.

The BMA's shipowners can rest assured their fleet will undergo fewer inspections at their ports that result in fewer detentions since the BMA has a first-class record for port state inspections.

It has a significant influence on national and international shipping policies and laws as an IMO Council member and active participant in the IMO Council's work.

As the Bahamas Shipowners Association works to represent the interests of the Authority's shipowners, the Authority listens to their voices as well. 

A global network of qualified inspectors, auditors, engineers, surveyors as well as technical and operational support staff, the Bahamas Maritime Authority has a wide range of expertise in the registration of vessels across a broad range of market sectors.

Code:

# Draw bahamas flag in turtle
from turtle import *

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

height=200  # flag hight
width=2*height # 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(0,169,206) # changing the pen color
    fillcolor(0,169,206) # 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


def draw_stripe(x_pos,y_pos,height,width):
    goto(x_pos,y_pos/3) # changing the position of the turtle pointer
    pencolor(253,218,37) # changing the pen color
    fillcolor(253,218,37) # 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/3) # Forward turtle by height/3 units
        right(90) # Turn right turtle by 90 degree
    end_fill() # ending the filling
    penup() # turtle pointer up

def draw_triangle(x_pos,y_pos,height):
    goto(x_pos,y_pos) # changing the position of the turtle pointer
    pencolor(0,0,0) # changing the pen color
    fillcolor(0,0,0) # filling the color
    pendown() # turtle pointer down
    begin_fill() # beginning the filling
    right(30) # Turn right turtle by 30 degree
    for i in range(3):
        forward(height) # Forward turtle by height units
        right(120) # Turn right turtle by 120 degree
    end_fill() # ending the filling
    penup() # turtle pointer up

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

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

Output:

Bahamas Flag Output

No comments:

Post a Comment

Draw bahamas flag in python turtle

  Bahamas Flag