【发布时间】:2014-05-02 19:16:35
【问题描述】:
我有一个绘制不同颜色形状的函数。我的问题是如何传递颜色列表来绘制这个形状。
def drawCircle(color, radius):
turtle.color(color)
turtle.penup()
turtle.setpos(0, -radius)
xpos=turtle.xcor()
ypos=turtle.ycor()
head=turtle.heading()
turtle.begin_fill()
turtle.pendown()
turtle.home()
turtle.setpos(xpos,ypos)
turtle.setheading(head)
turtle.circle(radius)
turtle.home()
turtle.end_fill()
turtle.penup()
colorList = ["red", "green", "blue", "black"]
drawCircle(colorList, 100)
这个函数应该是绕一个圆画圆弧或颜色:
【问题讨论】:
标签: python-3.x