-
Notifications
You must be signed in to change notification settings - Fork 0
/
random_polygons.py
30 lines (23 loc) · 964 Bytes
/
random_polygons.py
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
#!/usr/bin/env
'''Draw random sized polygons'''
import turtle
import random
from custom_modules.turtle_templates import polygon
from custom_modules.get_positive_number_from_user import get_positive_num
from custom_modules.turtle_templates import report_mouse_position
# Disable rendering to speed up drawing
turtle.hideturtle()
turtle.tracer(0)
print('How many random polygons')
how_many = int(get_positive_num())
for a_polygon in range(how_many): # call polygon()
polygon(
random.randrange(3, 11), # 3-11 sides
random.randrange(10, 51), # length ranges
random.randrange(-250, 251), # x-axis position ranges
random.randrange(-250, 251), # y-axis position ranges
random.choice(('red', 'lime', 'cyan', 'yellow', 'purple')) # Select color at random from tuple
)
report_mouse_position() # Track Mouse in terminal
turtle.update() # Render image
# turtle.exitonclick() # mouse click to exit