import turtle
t = turtle.Pen()
turtle.bgcolor(“black”)
sides = eval(input(“输入要绘制的边的数目(2-6)!”))
colors = [“red”, “yellow”, “green”, “blue”, “orange”, “purple”]
for x in range(100):
t.pencolor(colors[x % sides])
t.forward(x * 3 / sides + x)
t.left(360 / sides + 1)
t.width(x * sides / 200)
Python : Turtle库--3.11自定义边框
最新推荐文章于 2023-06-29 02:49:21 发布