废话不多说,直接上代码
黑白版
import turtle
turtle.speed(0)
for i in range(500):
turtle.fd(i)
turtle.right(91)
turtle.mainloop()
彩色版
import turtle
t = turtle.Pen()
turtle.bgcolor("black")
sides=4
colors=["red","yellow","green","blue",]
for x in range(500):
t.pensize(1)
t.speed(0)
t.pencolor(colors[x%sides])
t.forward(x*1/sides+x)
t.left(360/sides+1)
t.width(x*sides/1)
原文:https://www.cnblogs.com/hhh188764/p/13658464.html