-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPattern05.py
More file actions
38 lines (33 loc) · 913 Bytes
/
Pattern05.py
File metadata and controls
38 lines (33 loc) · 913 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
import turtle as t
from random import randint, random
def draw_star(points, size, col, x, y):
t.penup()
t.goto(x, y)
t.pendown()
angle = 180 - (180 / points)
t.color(col)
t.begin_fill()
for i in range(points):
t.forward(size)
t.right(angle)
t.end_fill()
def draw_planet(col, x, y):
t.penup()
t.goto(x, y)
t.pendown()
t.color(col)
t.begin_fill()
t.circle(50)
t.end_fill()
t.Screen().bgcolor('black')
while True:
ranPts = randint(2, 5) * 2 + 1
ranSize = randint(10, 50)
ranCol = (random(), random(), random())
ranX = randint(-350, 300)
ranY = randint(-250, 250)
draw_star(ranPts, ranSize, ranCol, ranX, ranY)
# ranColP = (random(), random(), random())
# ranXP = randint(-350, 300)
# ranYP = randint(-250, 250)
# draw_planet(ranColP, ranXP, ranYP)