Simple Python Turtle Graphic and Code: Simple Mandala 2

Опубликовано: 25 Апрель 2026
на канале: Basic Python Turtle Art
179
0

A star mandala enhanced with purplish bands and snaky lines. This graphic utilizes repeating shapes to keep the code short.

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 url at https://www.amazon.com/author/basicpy...

import turtle
t = turtle.Turtle() #Definitions and Initializations
screen = turtle.Screen()
t.pensize(4)
graphic_size = 125 #Length of spire base
number_of_spires = 5 #Number of shapes resembling chocolate kisses
spire_size = 0.64 #A portion of the graphic_size
def bow(): #Procedure for drawing two bands of bows with different colors
radius = graphic_size / 2 #Trail-less movement of turtle from origin to center of bow arcs
for color in ("violet", "purple"): #Loop to draw a band of bow with first color, and then another with second color
t.fillcolor(color) #Color filling procedure for one band of bow starts
t.begin_fill()
t.circle(radius, 180) #Drawing of a bow arc
t.left(90)
t.forward(radius / 2) #Drawing of width of bow band
t.left(90)
t.circle(-radius / 2, 180) #Drawing of another bow arc, this time clockwise
t.end_fill() #Color fill execution for current band of bow
t.penup()
t.left(90)
t.forward(1.5 * radius) #Trail-less movement of turtle to start of next bow band drawing
t.left(90)
t.pendown()
radius = graphic_size #Change of radius for next band drawing
def spire(x): #Procedure for drawing a spire, that resembles a chocolate kiss
t.forward(x * graphic_size) #Drawing of first half of spire base
t.left(90)
for i in range(2): #Loop to draw two snaky lines, each one with two arcs
t.circle(x * graphic_size, 60)
t.circle(-x * graphic_size, 60)
t.left(120)
t.left(30)
t.forward(x * graphic_size) #Drawing of second half of spire base
t.left(90 + 360 / (2 * number_of_spires)) #Python_graphic start of drawing procedure; Turtle rotation for first bow arc
t.penup()
for i in range(number_of_spires): #Loop to draw bow bands
t.forward(graphic_size) #Trail-less movement of turtle to center of bow bands
t.right(90) #Turtle rotation to start of bow bands
t.forward(graphic_size / 2) #Trail-less movement of turtle to start of bow bands drawing
t.left(90) #Turtle rotation to start of bow bands drawing
t.pendown() #Start of bow bands drawing
bow() #Function call to draw arcs for two bands of bows
t.penup()
t.home() #Trail-less movement of turtle to default location and direction
t.left(90 + (180 / number_of_spires) + (1 + i) * 360 / number_of_spires) #Turtle rotation for next bow bands
t.home()
t.left(90)
t.forward(0.9* graphic_size) #Trail-less movement of turtle to start of first spire pair drawing
t.right(90)
t.pendown()
for i in range(number_of_spires): #Loop to draw the initialized number of spire pairs
for color in ["yellow", "orange"]:
t.fillcolor(color) #Start of color fill procedure for first spire in a pair
t.begin_fill()
spire(spire_size) #Function call to draw a spire
t.end_fill() #Execution of color fill for one spire
t.right(180)
spire_size = 0.48 #Change of size for the second spire in a pair
spire_size = 0.64 #Restoration of spire size to initialoized value after drawing a spir pair
t.penup()
t.home()
t.left(90 + (1 + i) * 360 / number_of_spires) #Turtle rotation for drawing of next spire pair
t.forward(0.9* graphic_size) #Trail-less movement of turtle to start of next spire pair drawing
t.right(90)
t.pendown()
t.hideturtle()
screen.exitonclick()