"""
Program: CS 115 Lab 8a
Author: Your name
Description: This program displays national flags.
"""
from graphics import *
def draw_japan_flag(flag_width):
''' Draws the national flag of Japan in a graphics window.
Parameter: the width of the window
Returns: nothing
'''
flag_height = 2 / 3 * flag_width
circle_diameter = 3 / 5 * flag_height
# Open a new graphics window with the title 'Japanese flag',
# the width passed by the caller, and the calculated height
win = GraphWin('Japanese flag', flag_width, flag_height)
# Set the window background to white
win.setBackground('white')
# Set up the red circle.
flag_center = Point(flag_width / 2, flag_height / 2)
circle_radius = circle_diameter / 2
# Create a circle that is centered in the middle of the flag
# and has the specified radius
circ = Circle(flag_center, circle_radius)
# Turn that circle red
circ.setFill('red') # the inside of the circle
circ.setOutline('red') # the line around the circle
# Actually draw the circle
circ.draw(win)
# Close?
input('Press ENTER to close the flag window.')
win.close()
# --- Our main function ---
def main():
draw_japan_flag(600) # Draw a Japanese flag with a width of 600 pixels
main()

"""
This is just the STRUCTURE of your code. Don't copy this into your program!
"""
import statements
def draw_bangladesh_flag(flag_width):
code for Japanese flag (for now)
def draw_japan_flag(flag_width):
code for Japanese flag
def main():
draw_japan_flag(600)
main()
draw_bangladesh_flag(600)

def draw_stripe(window, top_left, bottom_right, color):
'''
Draws a rectangle in the window
Parameters:
- window: the window to draw in
- top_left: the coordinates of the top left corner (as a Point)
- bottom_right: the coordinates of the bottom right corner (as a Point)
- color: the color to make the rectangle (as a string)
Returns: nothing
'''
stripe = Rectangle(top_left, bottom_right)
stripe.setFill(color)
stripe.setOutline(color)
stripe.draw(window)
def draw_france_flag(flag_width):
'''
Draws a French flag in the graphics window.
Parameter: the width of the window
Returns: nothing
'''
flag_height = 2 / 3 * flag_width
stripe_colors = ['DarkBlue', 'white', 'red']
stripe_width = flag_width / len(stripe_colors)
# Open a new graphics window with the title 'French flag', the
# width provided by the user, and the calculated height
window = GraphWin('French flag', flag_width, flag_height)
# Draw the blue stripe
# The top left of the stripe is the top left of the window
blue_stripe_top_left = Point(0 * stripe_width, 0)
# The bottom right of the stripe is 1/3 of the way across
# the flag, and all the way to the bottom.
blue_stripe_bottom_right = Point(stripe_width, flag_height)
draw_stripe(window, blue_stripe_top_left, blue_stripe_bottom_right, stripe_colors[0])
######### Write similar code for the white and red stripes.
# Close?
input('Press ENTER to close the flag window.')
window.close()draw_france_flag(600)
for i in range(...something...):
stripe_top_left = Point(...something...)
stripe_bottom_right = Point(...something...)
draw_stripe(...4 things...)
Over the next few steps, you will modify this function to actually draw the national flag of Sudan:

triangle = Polygon(Point(50, 50), Point(100, 100), Point(25, 100))draws a triangle with vertices at (50, 50), (100, 100), and (25, 100).