Skip to content

Commit 9954281

Browse files
author
Karan Goel
committed
Alarm plays a sound instead of beep
1 parent 22becef commit 9954281

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Numbers/alarm.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
"""
22
Alarm Clock - A simple clock where it plays a sound after
33
X number of minutes/seconds or at a particular time.
4+
5+
Dependencies:
6+
pyglet
7+
pip install pyglet
48
"""
59

610
import time
711
import winsound
12+
import pyglet
813

914
if __name__ == '__main__':
1015
hh = input('What hour do you want to wake up (0-23)? ')
@@ -17,6 +22,8 @@
1722
hour = cur_time[3] # find the hour
1823
minute = cur_time[4] # and the minute
1924
if hour == hh and minute == mm:
20-
winsound.Beep(10000, 100) # play the beep
25+
song = pyglet.media.load('bin/sound.wav')
26+
song.play() # play the sound
27+
pyglet.app.run()
2128
not_alarmed = 0 # stop the loop
2229

0 commit comments

Comments
 (0)