What else can turtle do?
You can make more than one turtle. Just give them different names! You can then make them do different things or give them different colors.
import turtle
tina = turtle.Turtle()
tina.shape("turtle")
molly = turtle.Turtle()
molly.shape("turtle")
george = turtle.Turtle()
george.shape("turtle")
wilson = turtle.Turtle()
wilson.shape("turtle")
tina.color("black")
tina.forward(100)
molly.left(60)
molly.color("yellow")
molly.forward(100)
george.left(40)
george.color("blue")
george.forward(100)
wilson.left(20)
wilson.color("green")
wilson.forward(100)
We’ve given our turtles a Turtle shape but you can change that!!
import turtle
tina = turtle.Turtle()
molly = turtle.Turtle()
george = turtle.Turtle()
wilson = turtle.Turtle()
tina.shape('classic')
molly.shape('circle')
george.shape('turtle')
wilson.shape('triangle')
tina.forward(100)
molly.left(60)
molly.color("yellow")
molly.forward(100)
george.left(40)
george.color("blue")
george.forward(100)
wilson.left(20)
wilson.color("green")
wilson.forward(100)
Our turtles can move around without drawing. Just add .penup() to the end of their names to do this..
import turtle
tina = turtle.Turtle()
molly = turtle.Turtle()
george = turtle.Turtle()
wilson = turtle.Turtle()
tina.penup()
molly.penup()
george.penup()
wilson.penup()
tina.forward(100)
molly.left(60)
molly.color("yellow")
molly.forward(100)
george.left(40)
george.color("blue")
george.forward(100)
wilson.left(20)
wilson.color("green")
wilson.forward(100)
We can send our turtles out and have them ‘stamp’ the canvas with their shapes. Use .stamp() on the end of their name to do this.
import turtle
tina = turtle.Turtle()
molly = turtle.Turtle()
george = turtle.Turtle()
wilson = turtle.Turtle()
tina.penup()
molly.penup()
george.penup()
wilson.penup()
tina.forward(100)
tina.color("black")
tina.stamp()
tina.backward(100)
molly.left(60)
molly.color("yellow")
molly.forward(100)
molly.stamp()
molly.backward(100)
george.left(40)
george.color("blue")
george.forward(100)
george.stamp()
george.backward(100)
wilson.left(20)
wilson.color("green")
wilson.forward(100)
wilson.stamp()
wilson.backward(100)
Yes you can change the color of the window! This code will do that:
import turtle
window = turtle.Screen()
window.bgcolor("yellow")