Python Turtle Code: Rotating Triangle 1

Опубликовано: 22 Март 2026
на канале: Basic Python Turtle Art
1,217
4

A spiro art generated by 20 stamped images of a rotating triangle. The point of rotation is within the triangle. The Python Turtle code here has only less than 25 lines.

Please feel free to copy and paste the Python Turtle code below. Ask questions about the code if you have any, and please subscribe. Enjoy!! :)

import turtle
scrin = turtle.Screen()
t = turtle.Turtle()
t.pensize(5)
t.speed(4)
t.hideturtle()
for i in range(20):
t.penup()
t.goto(0, 0)
t.forward(100)
t.pendown()
t.right(145)
t.color("red")
t.forward(340)
t.right(120)
t.color("green")
t.forward(340)
t.right(120)
t.color("blue")
t.forward(340)
t.left(43) #angle 43 = 25 + 18
scrin.exitonclick()