Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import Turtle
- tina = Turtle()
- '''
- The draw_circle function takes the Turtle name, radius in pixels, color and position
- (as an x,y tuple) and then draws a circle.
- '''
- def draw_circle(t_name, r, col,p):
- t_name.penup()
- t_name.goto(p)
- t_name.color(col)
- t_name.dot(r*2)
- '''
- The following 9 calls to draw_circle will draw an "X" made of blue, red and yellow circles
- on the turtle graphics display canvas
- '''
- draw_circle(tina, 50, "blue",(100,100))
- draw_circle(tina, 100, "red",(300,300))
- draw_circle(tina, 75, "yellow",(0,0))
- draw_circle(tina, 50, "blue",(100,-100))
- draw_circle(tina, 100, "red",(300,-300))
- draw_circle(tina, 50, "blue",(-100,100))
- draw_circle(tina, 100, "red",(-300,300))
- draw_circle(tina, 50, "blue",(-100,-100))
- draw_circle(tina, 100, "red",(-300,-300))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement