Advertisement
jhoward48

Untitled

Nov 27th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1.  
  2. from turtle import Turtle
  3. tina = Turtle()
  4.  
  5.  
  6. def draw_circle(t_name, x, y, r, col):
  7.      t_name.color(col)
  8.      t_name.dot(r*2)
  9.      t_name.penup()
  10.      t_name.goto(x,y)
  11.      t_name.pendown()
  12.  
  13. draw_circle(tina,-25, 150,  200, "blue")
  14.  
  15. draw_circle(tina, -75, 100, 150, "pink")
  16.  
  17. draw_circle(tina, 10, 100, 50, "red")
  18. draw_circle(tina, 50, 100, 50, "red")
  19.  
  20.  
  21.  
  22. from turtle import*
  23. from random import*
  24.  
  25.  
  26.  
  27. def randomcolour():
  28.   colormode(255)
  29.   red = randint(0, 255)
  30.   green = randint(0, 255)
  31.   blue = randint(0, 255)
  32.   color(red, green, blue)
  33.  
  34. def randomplace():
  35.   penup()
  36.   x = randint(-100, 100)
  37.   y = randint(-100, 100)
  38.   goto(x, y)
  39.   pendown()
  40. def random_heading():
  41.      setheading(randint(1, 360))
  42.      
  43.      
  44.  
  45. shape("turtle")
  46. for i in range (30):
  47.           randomcolour()
  48.           randomplace()
  49.           random_heading()
  50.           stamp()
  51.  
  52. clear()
  53. setheading(0)
  54. def drawrectangle():
  55.      randomcolour()
  56.      randomplace()
  57.      speed(0)
  58.      hideturtle()
  59.      length =randint(10, 100)
  60.      height=randint(10, 100)
  61.      begin_fill()
  62.      forward(length)
  63.      right(90)
  64.      forward(height)
  65.      right(90)
  66.      forward(length)
  67.      right(90)
  68.      forward(height)
  69.      right(90)
  70.      end_fill
  71. clear()
  72. setheading(0)
  73. for i in range(20):
  74.      drawrectangle()
  75.  
  76.  
  77. turtle=Turtle()
  78.  
  79. def draw_circle():
  80.      randomcolour()
  81.      randomplace()
  82.      speed(0)
  83.      hideturtle()
  84.      radius=randint(1,200)
  85.      dot(radius)
  86.      end_fill
  87.  
  88. for i in range(50):
  89.      draw_circle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement