peterdcasey

Untitled

Jan 28th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import turtle
  2.  
  3. def draw_multicolor_square(t, sz):
  4.     """Make turtle t draw a multi-color square of sz."""
  5.     for i in ["red", "purple", "hotpink", "blue"]:
  6.         t.color(i)
  7.         t.forward(sz)
  8.         t.left(90)
  9.  
  10. wn = turtle.Screen()        # Set up the window and its attributes
  11. wn.bgcolor("lightgreen")
  12.  
  13. tess = turtle.Turtle()      # Create tess and set some attributes
  14. tess.pensize(3)
  15.  
  16. size = 20                   # Size of the smallest square
  17. for i in range(15):
  18.     draw_multicolor_square(tess, size)
  19.     size = size + 10        # Increase the size for next time
  20.     tess.forward(10)        # Move tess along a little
  21.     tess.right(18)          #    and give her some turn
  22.  
  23. wn.mainloop()
Add Comment
Please, Sign In to add comment