Bottom Right Triangle

Draw a triangle with nested loops.
nested_loops_bottom_right_triangle.py
 1"""
 2Example "Arcade" library code.
 3
 4Showing how to do nested loops.
 5
 6If Python and Arcade are installed, this example can be run from the command line with:
 7python -m arcade.examples.nested_loops_bottom_right_triangle
 8"""
 9
10# Library imports
11import arcade
12
13COLUMN_SPACING = 20
14ROW_SPACING = 20
15LEFT_MARGIN = 110
16BOTTOM_MARGIN = 110
17
18# Open the window and set the background
19arcade.open_window(400, 400, "Complex Loops - Bottom Right Triangle")
20
21arcade.set_background_color(arcade.color.WHITE)
22
23# Start the render process. This must be done before any drawing commands.
24arcade.start_render()
25
26# Loop for each row
27for row in range(10):
28    # Loop for each column
29    # Change the number of columns depending on the row we are in
30    for column in range(row, 10):
31        # Calculate our location
32        x = column * COLUMN_SPACING + LEFT_MARGIN
33        y = row * ROW_SPACING + BOTTOM_MARGIN
34
35        # Draw the item
36        arcade.draw_circle_filled(x, y, 7, arcade.color.AO)
37
38# Finish the render.
39arcade.finish_render()
40
41# Keep the window up until someone closes it.
42arcade.run()