-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMirrorSquares.py
More file actions
28 lines (23 loc) · 906 Bytes
/
MirrorSquares.py
File metadata and controls
28 lines (23 loc) · 906 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
28
import turtle
def draw_multicolor_square(t, sz):
"""Make turtle t draw a multi-color square of sz."""
for i in range(4):
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)
tess.speed(7)
size = 20 # Size of the smallest square
for i in range(17):
draw_multicolor_square(tess, size)
size = size + 20 # Increase the size for next time
tess.right(90) # and give her some turn
tess.penup()
tess.forward(10) # Move tess along a little
tess.left(90) # and give her some turn
tess.forward(-10) # Move tess along a little
tess.pendown()
# and give her some turn
wn.mainloop()