An image of sun made mystical by the paisleys around the center. The simple and structured Python Turtle code below defines the procedure for drawing the paisleys.
Feel free to copy the basic Python Turtle code that is given below. Don't hesitate to ask questions about the code if you have any. Enjoy! Please comment, like, or subscribe :)
Incidentally, for manually colorable graphics and variations, please visit my author site at https://www.amazon.com/author/basicpy...
import turtle
t = turtle.Turtle() #Definitions and Initializations
screen = turtle.Screen()
t.pensize(4)
radius = initial_radius = 240 #Changeable radius of graphic; fixed initial_radius
number_of_flares = 12 #Count of flare tips on sun's circumference
new_flare = () #Holder of ordered pair for a discovered point
list_of_flares = [] #Holder of ordered pairs corresponding to 2 flare tips on circumference
radius_change = 40 #Difference between radii of two overlapping suns
paisley_size = 150 #Length of paisley from top to bottom
number_of_paisleys = 6 #Count of paisleys around the center of graphic
def distance_between_flares(): #Procedure to start calculating line length from 1 flare tip to the next
t.left(90)
t.forward(radius)
t.left(90)
for i in range(2): #Loop to identify two ordered pairs corresponding to 2 flare tips
new_flare = t.position()
list_of_flares.append(new_flare)
t.circle(radius, 360 / number_of_flares)
t.goto(list_of_flares[0]) #Preparation to measure line from first flare tip to the next
def sun(x): #Procedure for drawing a color-filled sun with radius x
t.penup()
t.home()
t.left(90)
t.forward(x)
t.left(150 + 180 / number_of_flares)
t.pendown()
for i in range(number_of_flares):
t.circle(- (1 / (3 ** (1 / 2)) * (radius / initial_radius) * distance_bet_flares), 120) #A 120-degree arc between
t.left(360 / number_of_flares + 120) #two consecutive flare tips
def paisley(): #Procedure for drawing a paisley
t.circle(paisley_size / 4, 180)
t.circle(-(3 / 16) * paisley_size, 180)
t.right(90)
t.circle((1 / 8) * paisley_size, 270)
t.forward((1 / 8) * paisley_size)
t.circle((1 / 2) * paisley_size,180)
t.penup() #Python_Graphic start of drawing procedure
distance_between_flares() #Function call to start calculating distance between 2 flare tips
distance_bet_flares = t.distance(list_of_flares[1]) #Formula for calculating distance between 2 flare tips
for color in ["yellow", "gold", "yellow"]: #Loop to draw 3 overlapping suns with indicaated colors
t.fillcolor(color)
t.begin_fill()
sun(radius)
t.end_fill()
radius -= radius_change #Shortening of radius for the next color-filled sun
for i in range(number_of_paisleys): #Loop to draw the indicated number of color-filled paisleys
t.penup() #around the center of graphic
t.home()
t.left(((1 + i) * 360 / number_of_paisleys))
t.forward(50)
t.right(90)
t.pendown()
t.fillcolor("turquoise")
t.begin_fill()
paisley()
t.end_fill()
for i in range(number_of_paisleys): #Loop to draw color-filled circles on drawn paisleys
t.penup()
t.home()
t.left(((1 + i) * 360 / number_of_paisleys))
t.forward(65)
t.right(90)
t.pendown()
t.fillcolor("magenta")
t.begin_fill()
t.circle(22.5)
t.end_fill()
t.hideturtle()
screen.exitonclick()