week 12 graphic with animation Flashcards
turtle.addshape(“image.gif”)
add your image as a shape, turtle graphics only uses .gif
start point / end point
list of numbers that specify coordinates of start/end
using multiple turtles
just repeat the add turtle process
moose = turtle.Turtle()
moose.penup()
make screen background image
s.bgpic(“pink1.gif”)
adding data
load data with readlines
starting turtle environment
import turtle as t
t.forward(100)
sends turtle forward 100 steps
t.left(120)
sends turtle left 120 steps
clearscreen()
starts new graphic
t.color(‘red’)
changes line color to red
t.fillcolor(‘yellow’)
changes fill color to yellow
begin_fill()/end_fill()
turns fill on/off
turtle parameters
usually the distance as a float/int but can also be color, speed, etc
t.goto(x, y=None)
sends turtle to coordinate (x,y)
t.circle(radius, extent = None, steps = None)
turtle draws circle of radius and extent in specified number of steps