forked from karan/Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right now it beeps, need to add ability to play a sound.
- Loading branch information
Karan Goel
committed
Jul 13, 2013
1 parent
4e25c96
commit f1cfaec
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Alarm Clock - A simple clock where it plays a sound after | ||
X number of minutes/seconds or at a particular time. | ||
""" | ||
|
||
import time | ||
import winsound | ||
|
||
if __name__ == '__main__': | ||
hh = input('What hour do you want to wake up (0-23)? ') | ||
mm = input('What minute do you want to wake up (0-59)? ') | ||
|
||
not_alarmed = 1 | ||
|
||
while(not_alarmed): | ||
cur_time = list(time.localtime()) # get the time right now | ||
hour = cur_time[3] # find the hour | ||
minute = cur_time[4] # and the minute | ||
if hour == hh and minute == mm: | ||
winsound.Beep(10000, 100) # play the beep | ||
not_alarmed = 0 # stop the loop | ||
|