2017-03-05 129 views
-1

我是非常新的python。你可以直接告訴這個問題:我想繪製一系列圈(使用烏龜),像螺旋圖。到目前爲止,我可以製作不同的彩色圓圈,但它們都是一個一個地重疊在一起。我有一項家庭作業要完成使用烏龜。如何繪製螺旋狀的徑向圓?

回答

0

嗨歡迎來到堆棧溢出。爲了將來的參考知道,這個網站不是'做我的家庭作業'的網站。還有一些要記住的「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) 

每個塊龜打圈,然後再移動拿起筆起來,使下圓的中間的原始中間一致向下移動烏龜。該圈不過去的圈,並寫,因爲他們沒有在一個充滿

0

哇,我不知道是什麼無聊的,二流萬花尺@Whud了一起玩的孩子:

enter image description here

,但我想象的OP正在尋找更多的東西一樣:

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

+0

非常感謝您! –