Python 我如何改变乌龟的颜色,而不是笔的颜色?
你如何改变乌龟的颜色,而不是笔?我想让乌龟在屏幕上画白色,但是如果我把颜色改成“白色”,我就看不到乌龟了。有没有像海龟、套头衫之类的东西?当然有Python 我如何改变乌龟的颜色,而不是笔的颜色?,python,python-3.x,turtle-graphics,python-turtle,Python,Python 3.x,Turtle Graphics,Python Turtle,你如何改变乌龟的颜色,而不是笔?我想让乌龟在屏幕上画白色,但是如果我把颜色改成“白色”,我就看不到乌龟了。有没有像海龟、套头衫之类的东西?当然有 turtle.shape("turtle") turtle.fillcolor("red") 现在您得到了一只红海龟。我们可以使用用户光标定义功能将光标的颜色(轮廓和填充)与光标绘制的颜色(轮廓和填充)断开: from turtle import Screen, Shape, Turtle screen = Screen() screen.bgco
turtle.shape("turtle")
turtle.fillcolor("red")
现在您得到了一只红海龟。我们可以使用用户光标定义功能将光标的颜色(轮廓和填充)与光标绘制的颜色(轮廓和填充)断开:
from turtle import Screen, Shape, Turtle
screen = Screen()
screen.bgcolor('black')
turtle = Turtle()
turtle.shape("turtle")
polygon = turtle.get_shapepoly()
fixed_color_turtle = Shape("compound")
fixed_color_turtle.addcomponent(polygon, "orange", "blue")
screen.register_shape('fixed', fixed_color_turtle)
turtle.shape('fixed')
turtle.color('white')
turtle.circle(150)
screen.exitonclick()
此乌龟光标为橙色,带有蓝色轮廓,但它绘制了一条白线:
此乌龟绘制的颜色将与此乌龟光标的轮廓颜色相同。此乌龟填充的填充颜色将与此乌龟光标的填充颜色相同。我相信OP试图将这些概念分开,让乌龟的长相不反映乌龟的行为。记住接受答案。