-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drawing_AlexYu.py
executable file
·106 lines (62 loc) · 1.93 KB
/
Drawing_AlexYu.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
'''
Drawing_AlexYu
Alex Yu
Nov 21st 2017
version 1.0
The program creates a record with a smiley on it.
'''
import pygame
import random
import math
# colours
GREEN = (60, 179, 113, 0)
RED = (112, 0, 0, 50)
PURPLE = (75,0,130, 50)
WHITE = (255, 255, 255)
GREY = (100, 100, 100)
BLACK = (0, 0, 0)
pygame.init()
# screen
width = 1000
height = 1000
size = (width , height)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Alex Yu's Simple Drawing!")
done = False
clock = pygame.time.Clock()
while done != True:
# main loop
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
elif event.type == pygame.KEYDOWN:
done = True
screen.fill(WHITE)
modulus = random.randrange( 1 , 255 )
# modulus = 200
size = random.randrange( 5 , 20 )
#RECORD
circle_radius = 0
circle_radius2 = 210
circle_radius3 = 280
for j in range(255, 0, -1):
pygame.draw.circle(screen, GREY, [width / 2, height / 2], 255 + j, j)
for r in range(0, 200, 1):
pygame.draw.circle(screen, RED, [width / 2, height / 2], circle_radius + r, r)
for r2 in range(200, 250, 1):
pygame.draw.circle(screen, PURPLE, [width / 2, height / 2], circle_radius2 + r, r)
for r2 in range(300, 310, 1):
pygame.draw.circle(screen, GREY, [width / 2, height / 2], circle_radius3 + r, r)
# FACE
rect_size = 30
x_center = width / 2 - rect_size / 2
y_center = height / 2 - rect_size / 2
# LEFT EYE
pygame.draw.rect(screen, BLACK, (x_center - 60, y_center - 60, rect_size, rect_size), 0)
# RIGHT EYE
pygame.draw.rect(screen, BLACK, (x_center + 60, y_center - 60, rect_size, rect_size), 0)
# MOUTH
pygame.draw.arc(screen, BLACK, (x_center - (rect_size + 10), y_center + 60, rect_size * 8, rect_size * 2), math.pi, 3 * math.pi / 2, 10)
pygame.display.flip()
clock.tick(5)
pygame.quit()