3

How do you change what color the turtle looks, not the pen? I want the turtle to draw white on the screen, but if I change the color to 'white' I can't see the turtle anymore. Is there something like turtle.turtlecolor or something?

martineau
  • 119,623
  • 25
  • 170
  • 301

2 Answers2

4

We can disconnect the color of the cursor (both outline and fill) from the color drawn by the cursor (both outline and fill) using the user cursor definition functions:

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()

This turtle cursor is orange with a blue outline but it draws a white line:

enter image description here

cdlane
  • 40,441
  • 5
  • 32
  • 81
1

There sure is!

turtle.shape("turtle")
turtle.fillcolor("red")

Now you get a red turtle.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
David10za
  • 41
  • 1
  • 1
  • 5
  • The color drawn *by* this turtle will be the same as the outline color *of* this turtle cursor. The fill color filled *by* this turtle will be the same as the fill color *of* this turtle cursor. I believe the OP is trying to separate these concepts, having what the turtle *looks* like not reflect what the turtle *does*. – cdlane Apr 28 '20 at 05:06