-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhh.py
More file actions
27 lines (18 loc) · 703 Bytes
/
Copy pathhh.py
File metadata and controls
27 lines (18 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import turtle
def draw_multicolor_square(t, sz):
"""Make turtle t draw a multi-color square of sz."""
for i in ["red", "purple", "hotpink", "blue"]:
t.color(i)
t.forward(sz)
t.left(90)
wn = turtle.Screen() # Set up the window and its attributes
wn.bgcolor("lightgreen")
tess = turtle.Turtle() # Create tess and set some attributes
tess.pensize(3)
size = 15 # Size of the smallest square
for i in range(20):
draw_multicolor_square(tess, size)
size += 8 # Increase the size for next time
tess.forward(20) # Move tess along a little
tess.right(36) # and give her some extra turn
wn.mainloop()