-
Notifications
You must be signed in to change notification settings - Fork 0
/
alarm.py
38 lines (29 loc) · 994 Bytes
/
alarm.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
import winsound, sys, pygame, time
pygame.init()
#opens a pygame window blank to allow button inputs
pygame.display.set_caption('Keyboard Example')
size = [640, 480]
screen = pygame.display.set_mode(size)
#plays the alarm
def Alarm_Sound():
for i in range(7):
winsound.PlaySound("SystemHand", winsound.SND_ALIAS)
winsound.PlaySound("SystemExclamation", winsound.SND_ALIAS)
Alarm_Sound()
#choose to press left to end or down to snooze for 7 minutes
crashed = False
while not crashed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_DOWN:
time.sleep(420)
Alarm_Sound()
crashed = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
pygame.quit()
sys.exit()
pygame.quit()
sys.exit