【发布时间】:2021-07-28 02:33:42
【问题描述】:
那么我在这里错过了什么?我只需要两只眼睛都被红色填充。我不确定“def eye”缺少什么,但我确定那是我犯错的地方。
import turtle
t = turtle.Turtle()
def DCircle(x,y,radius,color):
t.penup()
t.setposition(x,y)
t.pendown()
t.fillcolor(color)
t.begin_fill()
t.color(color)
t.circle(radius)
t.end_fill()
def eye(color, radius):
t.penup()
t.setposition(-50,40)
t.pendown()
t.fillcolor(color)
t.color(red)
t.begin_fill()
t.circle(radius)
t.end_fill()
def Mickey():
r = 50
DCircle(0,0,2*r,'blue')
DCircle(-135,115,r,'red')
DCircle(135,115,r,'red')
def Main():
Mickey()
turtle.done()
turtle.bye()
turtle.getscreen()._root.mainloop()
Main()
【问题讨论】:
-
我认为这段代码运行良好,你的预期输出是什么,你现在得到的输出是什么?
-
嗯,我应该有两个圆形的眼睛,里面都是红色的。你有两只眼睛在红色填充的蓝色脸上吗?
-
哦!你是说里面的蓝色!蓝圈外没有。
-
我得到了红色的圆形耳朵。蓝色圆脸。但我没有看到红色的圆形眼睛。
-
是的,在蓝色圆圈内。
标签: python python-turtle