tinker_spiral.py

#!/usr/bin/python3
# ===================================================================
# From: www.tynker.com/weekly-projects/spiraling-shapes-python
# ===================================================================
# FYI: stackoverflow.com/questions/60917905/
#      turtle-graphics-how-do-i-implement-a-pause-function
# ===================================================================

# import the turtle library and create the turtle
import turtle
t = turtle.Turtle()

# drawa dot at the center of the screen
t.dot()
t.speed(8)
t.screen.title("Draw A Spiral Shape")

def draw_shape_spiral(sides,length,angle,color):

    for i in range(round(360/angle)):
    
        # turn the pen clockwise
        #rotate by a specified angle
        t.penup()
        t.right(angle)
        
        # go to center point and move to position
        t.goto(0,0)
        t.forward(round(length/2))
        
        # set the shape color
        t.pencolor(color)

        # draw the shape with a specific number of
        # sides and length
        t.down()
        for _ in range(sides):
            t.right(round(360/sides))
            t.forward(length)

# draw a spiral
#draw_shape_spiral(5,100,20,'green')
#draw_shape_spiral(3, 30, 45, 'orange')
#draw_shape_spiral(8, 50, 30, 'blue') 
#draw_shape_spiral(5, 40, 90, 'orange')
#draw_shape_spiral(4,150, 32, 'pink')

# draw two together
#draw_shape_spiral(5, 80, 20, 'green')
#draw_shape_spiral(4, 70, 45, 'orange')

# draw three together
# 1. draw a green pentagon
# 2. draw a large green pentagon
# 3. draw spirals closer together
draw_shape_spiral(5, 50, 40, 'green')
draw_shape_spiral(5,100, 40, 'green') 
draw_shape_spiral(5,100, 20, 'green')

# draw four together
#draw_shape_spiral(3, 30, 45, 'orange')
#draw_shape_spiral(8, 50, 30, 'blue') 
#draw_shape_spiral(5, 40, 90, 'orange')
#draw_shape_spiral(4,150, 32, 'pink')

t.screen.mainloop()