Changing the Turtle and Pen Color
When you first open a new screen, the turtle starts out as a black
figure and draws with black ink. Based on your requirements, you can do
two things.
- Change the color of the turtle: This changes the fill color.
- Change the color of the pen: This changes the outline or the ink color.
You can even choose both of these if you wish. Before you change the
colors, increase the size of your turtle to help you see the color
difference more clearly.
Source Code:
import turtle as t
t.shapesize(3,3,3)
Output:
Now, to change the color of the turtle, you type the following:
Source Code:
import turtle as t
t.fillcolor("red")
Output:
To change the color of the pen (or the outline), you type the following:
Source Code:
import turtle as t
t.pencolor("green")
t.pencolor("green")
Output:
To change the color of both, you type the following:
Source Code:
import turtle as t
t.color("green", "red")
t.color("green", "red")
Output:
Recommended Posts:
- The Turtle Graphics Package
- Turtle Graphics Method
- Programming With Turtle
- Drawing a Shape
- Drawing Preset Figures
- Changing the Screen Color
- Changing the Screen Title
- Changing the Turtle Size
- Changing the Pen Size
Comments
Post a Comment