【发布时间】:2014-06-20 12:05:46
【问题描述】:
有人做过吗?在保存时使用多种颜色。
我有一个颜色列表:
colors = ["#880000",\
"#884400",\
"#888800",\
"#008800",\
"#008888",\
"#000088",\
"#440088",\
"#880088"]
我的目标是获取颜色列表并将其传递给海龟,以便它可以在一条线中画出一个彩色圆圈。
我的功能如下:
def drawImage(colorList, radius):
for color in colorList:
turtle.color(color)
turtle.penup()
turtle.setpos(0, -radius)
xpos=turtle.xcor()
ypos=turtle.ycor()
turtle.begin_fill()
turtle.pendown()
turtle.home()
turtle.setpos(xpos,ypos)
turtle.circle(radius)
turtle.end_fill()
turtle.color('black')
turtle.width(2)
turtle.circle(radius)
return
上述函数的问题在于它只使用一种颜色而不是列表中不同颜色的小弧线进行绘制。谁能帮我解决这个问题或指出我做错了什么?
该函数被称为drawImage(colors,200),这将绘制一个半径为200的彩色圆圈
【问题讨论】:
标签: python python-2.7 python-3.x colors