python

用python画出奇怪的旋转形状

2020-12-17  本文已影响0人  蓝不蓝编程

效果图

代码

#SquareSpiral1.py
import turtle
t = turtle.Pen()
turtle.bgcolor("black")
sides=6
colors=["red","yellow","green","blue","orange","purple"]
for x in range(360):
    t.pencolor(colors[x%sides])
    t.forward(x*3/sides+x)
    t.left(360/sides+1)
    t.width(x*sides/200)


print("####结束####")

上一篇 下一篇

猜你喜欢

热点阅读