Luminaria_YYY
Luminaria_YYY

Reputation: 63

How do I change the color of the turtle, not the pen?

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?

Upvotes: 3

Views: 1934

Answers (2)

cdlane
cdlane

Reputation: 41872

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

Upvotes: 4

David10za
David10za

Reputation: 41

There sure is!

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

Now you get a red turtle.

Upvotes: 1

Related Questions