Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from turtle import Turtle
  2.  
  3. tina = Turtle()
  4. '''
  5. The draw_circle function takes the Turtle name, radius in pixels, color and position
  6. (as an x,y tuple) and then draws a circle.
  7. '''
  8.  
  9. def draw_circle(t_name, r, col,p):
  10. t_name.penup()
  11. t_name.goto(p)
  12. t_name.color(col)
  13. t_name.dot(r*2)
  14.  
  15. '''
  16. The following 9 calls to draw_circle will draw an "X" made of blue, red and yellow circles
  17. on the turtle graphics display canvas
  18. '''
  19. draw_circle(tina, 50, "blue",(100,100))
  20. draw_circle(tina, 100, "red",(300,300))
  21. draw_circle(tina, 75, "yellow",(0,0))
  22. draw_circle(tina, 50, "blue",(100,-100))
  23. draw_circle(tina, 100, "red",(300,-300))
  24. draw_circle(tina, 50, "blue",(-100,100))
  25. draw_circle(tina, 100, "red",(-300,300))
  26. draw_circle(tina, 50, "blue",(-100,-100))
  27. draw_circle(tina, 100, "red",(-300,-300))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement