forked from jeffmiller00/PlayingWithPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateSquares2.py
More file actions
40 lines (30 loc) · 715 Bytes
/
createSquares2.py
File metadata and controls
40 lines (30 loc) · 715 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
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# This program is for
# Author: MYGNU
# Please feel free to copy, distribute and modify till your heart is content
import turtle
wn = turtle.Screen()
wn.bgcolor('lightblue')
sq = turtle.Turtle()
def crsqr(t,num):
"""creates squares of 20 units, takes turtle object and number of squares max 10
"""
sz = 20
while sz <= num:
t.forward(sz)
t.right(90)
t.forward(sz)
t.right(90)
t.forward(sz)
t.right(90)
t.forward(sz)
t.up()
t.forward(10)
t.right(90)
t.backward(10)
t.down()
sz += 20
sq.pensize(4)
sq.color('hotpink')
crsqr(sq,300)
wn.exitonclick()