如何画螺旋形的径向圆?

2024-05-12 02:53:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我对python很陌生。你可以通过这个问题直接告诉你:我想画一系列的圆(用海龟),类似于螺旋图。到目前为止,我能画出不同颜色的圆圈,但它们都是在另一个上面画一个。我有一个作业要用海龟来完成。在


Tags: 颜色作业海龟圆圈螺旋陌生
2条回答

哇,我不知道小时候该玩什么无聊的廉价螺旋钻:

enter image description here

但我在想象,手术室正在寻找更像这样的东西:

from turtle import Turtle, Screen
from itertools import cycle

COLOR_NAMES = ['red', 'magenta', 'blue', 'cyan', 'green', 'yellow']

colors = cycle(COLOR_NAMES)

yertle = Turtle()
yertle.speed("fastest")  # because I have no patience

for _ in range(36):
    yertle.color(next(colors))
    yertle.circle(50)
    yertle.left(10)

yertle.hideturtle()

screen = Screen()
screen.exitonclick()

enter image description here

嗨,欢迎来到堆栈溢出。为了将来参考,知道这个网站不是一个'做我的家庭作业'网站。另外要记住的是“if your problem is with code you've written, you should include some.”你的问题也是非常模糊的“一系列圆圈(使用海龟)有点像螺旋图”可能意味着事物的分配

话虽如此,但我希望这对你有所帮助,也是你正在寻找的系列:

import turtle


turtle.circle(50)
turtle.pu()          #pen up
turtle.sety(-50)

turtle.pd()          #pen down
turtle.circle(100)
turtle.pu()
turtle.sety(-100)

turtle.pd()
turtle.circle(150)
turtle.pu()
turtle.sety(-150)

turtle.pd()
turtle.circle(200)

在每一个方块中,乌龟先画一个圆圈,然后移动,然后拿起笔,然后向下移动,这样下一个圆圈的中间与原来的中间相匹配。圆圈不写在最后一个圆圈上,因为它们没有被填充。在

相关问题 更多 >