Рубрики

drawing

Simple instructions for drawing the flag of America

* Some of the links in this post may be affiliate links. This means I receive small commissions for purchases made through these links at no extra cost to you.


Draw Flag of USA using Python Turtle

Draw Flag of USA using Python Turtle

Welcome everyone to copyassignment.com . In this tutorial, we are going to draw the Flag of USA using Python Turtle. The python turtle module is very easy to understand and learn. Python beginners can easily grasp the turtle functions as we are providing the comments and a detailed explanation of the code.

Complete Code to Draw the Flag of USA using Python Turtle

#import the time and turtle module import turtle import time # create a screen scr = turtle.getscreen() scr.title("Flag of America") scr.bgcolor("white") #Set the turtle object and speed of the turtle t = turtle.Turtle() t.speed(20) t.penup() # flag height and width flag_ht = 250 flag_wth = 475 # starting points of the flag x1 = -250 y1 = 120 # red and white stripes (total 13 stripes in flag) stripe_ht = flag_ht/13 stripe_wdt = flag_wth #star size star_size = 12 def draw_rectangle(x, y, height, width, color): t.goto(x,y) t.pendown() t.color(color) t.begin_fill() t.forward(width) t.right(90) t.forward(height) t.right(90) t.forward(width) t.right(90) t.forward(height) t.right(90) t.end_fill() t.penup() def star_shape(x,y,color,length) : t.goto(x,y) t.setheading(0) t.pendown() t.begin_fill() t.color(color) for turn in range(0,5) : t.forward(length) t.right(144) t.forward(length) t.right(144) t.end_fill() t.penup() # function to create stripes of flag def draw_stripes(): x = x1 y = y1 # draw 6 red and 7 white strips for stripe in range(0,6): for color in ["red", "white"]: draw_rectangle(x, y, stripe_ht, stripe_wdt, color) # decrease value of y by stripe_height y = y - stripe_ht # create last red stripe draw_rectangle(x, y, stripe_ht, stripe_wdt, 'red') y = y - stripe_ht # this function create navy color square def draw_square(): square_ht = (7/13) * flag_ht square_wdt = (0.76) * flag_ht draw_rectangle(x1, y1, square_ht, square_wdt, 'navy') #defining a function for drawing a 6 row star def stars1(): dist_of_stars = 30 dist_bet_lines = stripe_ht + 6 y = 112 # create 5 rows of stars for row in range(0,5) : x = -234 # create 6 stars in each row for star in range (0,6) : star_shape(x, y, 'white', star_size) x = x + dist_of_stars y = y - dist_bet_lines def stars_five(): dist_of_stars = 30 dist_bet_lines = stripe_ht + 6 y = 100 # create 4 rows of stars for row in range(0,4) : x = -217 # create 5 stars in each row for star in range (0,5) : star_shape(x, y, 'white', star_size) x = x + dist_of_stars y = y - dist_bet_lines #Call all the functions # start after 5 seconds. time.sleep(5) # draw 13 stripes draw_stripes() # draw squares draw_square() # draw 30 stars, 6 * 5 stars1() # draw 20 stars, 5 * 4 stars_five() # hides the turtle t.hideturtle() scr.mainloop()

Output to Draw Flag of USA using Python Turtle

Now, let’s understand code by breaking it into sub-parts.

1. Importing the Modules

#import the time and turtle module import turtle import time

In our program, the import function imports the turtle and the time module which provides us with some inbuilt functions which is required while creating the program.

2. Initializing the Turtle

# create a screen scr = turtle.getscreen() scr.title("Flag of America") scr.bgcolor("white") #Set the turtle object and speed of the turtle t = turtle.Turtle() t.speed(20) t.penup()

Here we have created an scr object by using the getscreen() function of the turtle. It creates the output window and, sets the title of the window and background color.

The turtle object ‘t’ is created and we have set the speed of the turtle to 20 by using the speed function. The penup() function doesn’t allow the turtle to draw anything till the next instruction.

3. Initialization of variables

# flag height and width flag_ht = 250 flag_wth = 475 # starting points of the flag x1 = -250 y1 = 120 # red and white stripes (total 13 stripes in flag) stripe_ht = flag_ht/13 stripe_wdt = flag_wth #star size star_size = 12

Here we have initialized the height and width of the flag to 250 and 475 respectively. The x1 and y1 are starting coordinates for the flag. The flag height is divided by 13 as we want 13 strips for the flag i.e approximately 19.3 is the height of each stripe that is assigned to strip_ht. The size of each arm of the star is initialized to 12.

4. Function to create a Rectangle for the Flag of USA using Python Turtle

def draw_rectangle(x, y, height, width, color): t.goto(x,y) t.pendown() t.color(color) t.begin_fill() t.forward(width) t.right(90) t.forward(height) t.right(90) t.forward(width) t.right(90) t.forward(height) t.right(90) t.end_fill() t.penup()

In the function draw_rectangle() we have given the parameters x,y,height,width,color. These parameters will take the values to draw the rectangle shape accordingly. The goto(x,y) function sets the x,y location of the rectangle. The pendown() function begin’s the drawing. The color function takes the color that is filled in the shape using The begin_fill() and end_fill() function.

5. Function for creating a star shape

def star_shape(x,y,color,length) : t.goto(x,y) t.setheading(0) t.pendown() t.begin_fill() t.color(color) for turn in range(0,5) : t.forward(length) t.right(144) t.forward(length) t.right(144) t.end_fill() t.penup()

Here we have created a function star_shape() which takes the x,y, color, and length parameters. The setheading (0) allows the turtle to always point to the east direction while drawing the star. Here we have created the for loop that takes 5 turns to draw a star of a specified length. The right(144) is the angle provided to generate a star shape.

6. Function for creating the stripes of the Flag of USA using Python Turtle

# function to create stripes of flag def draw_stripes(): x = x1 y = y1 # draw 6 red and 7 white strips for stripe in range(0,6): for color in ["red", "white"]: draw_rectangle(x, y, stripe_ht, stripe_wdt, color) # decrease value of y by stripe_heighFt y = y - stripe_ht # create last red stripe draw_rectangle(x, y, stripe_ht, stripe_wdt, 'red') y = y - stripe_ht

Here, the function is used to create the red and white strips of the American flag where x and y are initialized to x1 and y1 i.e. the starting position. We are drawing 6 red and 7 white strips for that we are using the for loop function and another for loop for the colors “red “ and “white”. The draw rectangle function will take the parameters from here. For each iteration, the value of y is decreased by the strip height and assigned to y.

7. Function for creating a navy color square of Flag of USA using Python Turtle

# this function create navy color square def draw_square(): square_ht = (7/13) * flag_ht square_wdt = (0.76) * flag_ht draw_rectangle(x1, y1, square_ht, square_wdt, 'navy')

The function draw_square() draws the square that is present on the American flag. The values for the square height and width are calculated using the flag’s height. The function draw rectangle takes the parameters including the color” navy” to create the square on the flag.

8. Function for creating the 6 stars rows

#defining a function for drawing a 6 row star def stars1(): dist_of_stars = 30 dist_bet_lines = stripe_ht + 6 y = 112 # create 5 rows of stars for row in range(0,5) : x = -234 # create 6 stars in each row for star in range (0,6) : star_shape(x, y, 'white', star_size) x = x + dist_of_stars y = y - dist_bet_lines

The function stars1() draws a 6-row star in a navy blue square. The distance between each star is 30 and the distance between the lines is initialized to addition on strip height and 6. The for loop function draws the 6-star rows where x location is initialized to -234. For each iteration, the location of x is increased by 30. The y points location is decreased by the value assigned to dist_bet_lines.

9. Function for creating the 5 stars rows

def stars_five(): dist_of_stars = 30 dist_bet_lines = stripe_ht + 6 y = 100 # create 4 rows of stars for row in range(0,4) : x = -217 # create 5 stars in each row for star in range (0,5) : star_shape(x, y, 'white', star_size) x = x + dist_of_stars y = y - dist_bet_lines

The function stars_five() is similar to the above function stars1() the only change is in the location of the x and y points.

Here, we successfully completed drawing the Draw Flag of the USA using the Python Turtle module. Hope you find this article useful. For more articles on turtle keep visiting our website.

Also Read:

  • Radha Krishna using Python Turtle
  • Drawing letter A using Python Turtle
  • Wishing Happy New Year 2023 in Python Turtle
  • Snake and Ladder Game in Python
  • Draw Goku in Python Turtle
  • Draw Mickey Mouse in Python Turtle
  • Happy Diwali in Python Turtle
  • Draw Halloween in Python Turtle
  • Write Happy Halloween in Python Turtle
  • Draw Happy Diwali in Python Turtle
  • Extract Audio from Video using Python
  • Drawing Application in Python Tkinter
  • Draw Flag of USA using Python Turtle
  • Draw Iron Man Face with Python Turtle: Tony Stark Face
  • Draw TikTok Logo with Python Turtle
  • Draw Instagram Logo using Python Turtle
  • I Love You Text in ASCII Art
  • Python Turtle Shapes- Square, Rectangle, Circle
  • Python Turtle Commands and All Methods
  • Happy Birthday Python Program In Turtle
  • I Love You Program In Python Turtle
  • Draw Python Logo in Python Turtle
  • Space Invaders game using Python
  • Draw Google Drive Logo Using Python
  • Draw Instagram Reel Logo Using Python
  • Draw The Spotify Logo in Python Turtle
  • Draw The CRED Logo Using Python Turtle
  • Draw Javascript Logo using Python Turtle
  • Draw Dell Logo using Python Turtle
  • Draw Spider web using Python Turtle




American Flag Drawing

We begin by drawing out our main lines for our American flag. These lines will represent the folds of our flag. This will help give the illusion that it’s moving.

Using a ruler, draw your first line for your flag. For your first section you need to make sure you leave enough space to draw in your stars. The sections after that can be fairly close together without causing any problems.

You can use a pencil first, or draw it with the Sharpie marker. I like using cardstock for most of my drawings. However, when doing this project with my students I used 12×18 drawing paper.

How-To-Draw-An-Op-Art-American-Flag-Lines

You want to draw all of your lines on an angle. And you need to alternate yours lines being closer together at the top and then further apart at the top.

Ezoic

American Flag Drawing – Op Art Stripes

When drawing your stripes, you need to make curved lines. The process is similar to the one we learned in Bullseye Op Art Drawing. By drawing the lines curved, you’ll begin to create the optical illusion.

Draw your first curved line in the first section towards the top. The space between this line and the top edge of your paper needs to be slightly larger than the rest of your lines because this is where your stars will go.

Continue drawing curved lines down your paper until you reach the bottom. You want your lines to be fairly evenly spaced apart.

Move onto the next section, but this time curve your lines in the opposite direction. Your lines should line up with each other from left to right.

Ezoic How-To-Draw-An-Op-Art-American-Flag-Lines-Stripes

Continue working your away across your drawing, alternating the direction the lines curve. Add a couple more next to where your stars will go.

Add some stars to your first section on the top left. Again, they don’t have to be perfect. You can add as few or as many stars as you ant to add.

Drawing an Optical Illusion with Color Gradation

You can use whatever medium you want for your colors. Colored pencils were used for this example. I typically use Prismacolor colored pencil for all of my work, but because I was doing this with my students, I used Crayola colored pencils. Either one is fine for your waving flag drawing.

In the first stripe underneath where your stars are, use red to color in that section. Use gradation to make your edges darker than the center. This will add to the optical illusion.

To do this, add multiple layers of color. Gradually build up the color a little at a time, making it darker at the edges and fading it out towards the center.

The section directly below the red and to the right of the red will be left white. You should never have two adjacent sections the same color.

Continue working on your stripes until every other one is colored red. At this point your waving flag drawing is starting to take shape.

When you’re finished with all of your stripes, use blue to fill in the color around your stars.

How-To-Draw-An-Op-Art-American-Flag-Colored

You can also use the blue to add shadows to all of the white stripes. Or black can be used for the shadows on the white. And of course gray is a good option as well.

That’s it, you’re all done. You have many options when working on your flags. I like using markers for most of my work because of how bright and colorful they are.

For the price, Bic markers are my personal choice. You can do your waving flag drawing with markers, colored pencils, or any other medium you like to use.

How-To-Draw-An-Op-Art-American-Flag-Marker

Waving Flag Drawing Ideas

Like with anything, practicing will help you improve. The more you practice the better you will get. And, the more your creativity will improve. Experiment and try new things. Have fun and don’t get stressed about the results.

You can try some different colors to use for your shadows. For the examples below, I used gray or black to add some shadows and created depth.

By trying new things and experimenting, you can figure out what you like and what you don’t like. The more you try new things the easier it will get. Try doing as many waving flag drawings as you can. They more you do the better you’ll get at drawing them.

Waving-Flag-Drawing-Ideas

Simple instructions for drawing the flag of America

I’m leading the Cub Scouts on their Building a Better World Adventure. We had a lot of information to cover about the US flag, so I decided to start off by making sure the boys knew what the flag looks like. I taped paper to the wall and set a chair in front of it, facing the audience. One by one, each boy sat in the chair and described to me how to draw the flag.

Sounds easy enough, right? Nope. I did my best to follow the directions each boy gave EXACTLY. If they weren’t specific about something like vertical vs. horizontal vs. diagonal, I intentionally chose to interpret their instructions incorrectly.

Trevor was the first volunteer. Here’s his finished flag:

His instructions? “Using a blue pen, draw a box in the upper left corner. No, wait. Draw a medium-sized box. Put 50 white stars in the box. Now put 14 red lines to the right of the blue box with white space between them.”

Each boy was able to learn from the others’ mistakes, but that didn’t always help, as there were plenty of other mistakes to be made! Here, J has just realized from the rest of the group’s hysterics that he didn’t specify how long the red lines to the right of the blue square should be.

I should mention: I know these boys well and they know each other well. I knew that none of them would get their feelings hurt during this game, but I was also careful in who I selected to go first. That person is likely to do the worst and will be the first to experience the group laughing at something he couldn’t see. I was relieved when Trevor volunteered to go first because I knew that he would find his mistakes just as funny as the audience did. All of the boys were great sports during their turn in the hot seat. We had a great time laughing together and everyone got the message – how important it is to be clear and specific when communicating directions.

L was the last to go. He nailed the colors, the rectangle size and placement, and the number and direction of the stripes. The stars weren’t right and he forgot to clarify the placement of the stripes.

Here are all 7 Scouts, proudly showing off their flags. They’re standing in the order they went. You can see the improvement in communication as they learned from each other’s mistakes.

Colin Wynn
the authorColin Wynn

Leave a Reply