MrThoe

2.10

Sep 13th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. """
  2. This code will fill the canvas with light blue circles with a highlight on each.
  3. """
  4. speed(0)
  5.  
  6. # This function will draw one row of 10 circles
  7. def draw_circle_row():
  8.     for i in range(10):
  9.         pendown()
  10.         begin_fill()
  11.         color("lightblue")
  12.         circle(20)
  13.         end_fill()
  14.         penup()
  15.         forward(40)
  16.  
  17. # This function will draw a highlight on each bubble
  18. def make_highlight():
  19.     for i in range(10):
  20.         forward(10)
  21.         left(90)
  22.         forward(20)
  23.         pendown()
  24.         circle(10,90)
  25.         penup()
  26.         left(90)
  27.         forward(30)
  28.         left(90)
  29.         forward(40)
  30.        
  31.        
  32. # This function will move Tracy from end of row up to the beginning of the row on top        
  33. def move_up_a_row():
  34.     left(90)
  35.     forward(40)
  36.     right(90)
  37.     backward(400)
  38.    
  39. # Send Tracy to starting position in bottom left corner
  40. penup()
  41. setposition(-180,-200)
  42.  
  43. # Call circle drawing function 10 times to fill ten rows
  44. for i in range(10):
  45.     draw_circle_row()
  46.     move_up_a_row()
  47.    
  48. # Move back to beginning
  49. right(90)
  50. forward(400)
  51. left(90)
  52. color("white")
  53.  
  54. # Draw the highlight on each bubble row by calling highlight function and moving up a row
  55. for i in range(10):
  56.     make_highlight()
  57.     move_up_a_row()
Add Comment
Please, Sign In to add comment