60个倾斜的圆,中间有孔

时间:2019-03-16 03:46:47

标签: python geometry shapes spiral

我制作了一些东西,其中有60个圆形成一个大圆,但是我想知道如何在中间制作一个小孔。感谢您的帮助!

What mine looks like rn What I want it to look like

我的代码

import turtle

turtle.setup(1000,1000)
turtle.hideturtle()

turtle.speed(0)
turtle.up()
turtle.goto(0,0)
turtle.down()
n = 60
for i in range(n):
    turtle.circle(200)
    turtle.left(360/n)

1 个答案:

答案 0 :(得分:0)

尝试以下操作,然后修改值。

import turtle

turtle.setup(1000,1000)
turtle.hideturtle()

turtle.speed(0)
turtle.up()
turtle.goto(0,0)
turtle.down()
n = 20
for i in range(n):
    turtle.up()
    turtle.backward(150)
    turtle.right(15)
    turtle.down()

    turtle.circle(100)

    turtle.up()
    turtle.left(15)
    turtle.forward(150)
    turtle.up()

    turtle.left(360/n)