SHARE
TWEET

turtle art

Grafundzijus Apr 25th, 2019 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from turtle import Turtle
  2.  
  3. donatelo = Turtle()
  4. length = 300
  5. height = 50
  6. triangle_side = 100
  7.  
  8. def draw_circle(name, coordinates, r, color):
  9.     name.penup()
  10.     name.goto(coordinates)
  11.     name.pendown()
  12.     name.color(color)
  13.     name.circle(r*2)
  14.    
  15. def draw_dot(name, coordinates, r, color):
  16.     name.penup()
  17.     name.goto(coordinates)
  18.     name.pendown()
  19.     name.color(color)
  20.     name.dot(r*2)
  21.    
  22. def draw_recktangle(name, coordinates, color):
  23.     name.penup()
  24.     name.goto(coordinates)
  25.     name.pendown()
  26.     name.color(color)
  27.     name.begin_fill()
  28.     name.forward(length)
  29.     name.right(-90)
  30.     name.forward(height)
  31.     name.right(-90)
  32.     name.forward(length)
  33.     name.right(-90)
  34.     name.forward(height)
  35.     name.end_fill()
  36.  
  37. def draw_triangle(name, coordinates, color):
  38.     name.penup()
  39.     name.goto(coordinates)
  40.     name.pendown()
  41.     name.color(color)
  42.     name.left(150)
  43.     name.forward(triangle_side)
  44.     name.right(120)
  45.     name.forward(triangle_side)
  46.     name.right(120)
  47.     name.forward(triangle_side)
  48.    
  49.    
  50. draw_circle(donatelo, (-100, 0), 25, "black")
  51. draw_circle(donatelo, (100, 0), 25, "black")
  52. draw_recktangle(donatelo, (-150, 100), "green")
  53. draw_triangle(donatelo, (-60, 150), "red")
  54. draw_dot(donatelo, (100, 50), 15, "grey")
  55. draw_dot(donatelo, (-100, 50), 15, "grey")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top