Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Beep():
- #Aidan's code
- #This function defines the sound that will play when the timer runs out
- import winsound
- duration = 1000 # millisecond
- freq = 550 # Hz
- winsound.Beep(freq, duration)
- duration = 1000
- freq = 1000
- winsound.Beep(freq,duration)
- duration = 1250
- freq = 750
- winsound.Beep(freq,duration)
- priority = raw_input("set priority")
- event = "dinner"
- def sound():
- #Aidan's code
- #This function plays the sound at the desired length, depending on the priority the user had set
- import time
- beepLength = 0
- if priority == "high":
- #highest priority, uses a while loop to play the Beep() function until it has played 5 times. It will then state which event you had the reminder for
- while True:
- Beep()
- time.sleep(1)
- beepLength += 1
- if beepLength == 5:
- print "\nIt is time for" , event
- break
- if priority == "medium":
- #medium priority, same loop as before, but plays the sound only 3 times
- while True:
- Beep()
- time.sleep(1)
- beepLength += 1
- if beepLength == 3:
- print "\nIt is time for" , event
- break
- if priority == "low":
- #low priority, plays the sound twice
- while True:
- Beep()
- time.sleep(1)
- beepLength += 1
- if beepLength == 2:
- print "\nIt is time for" , event
- break
- def timer_for_sound():
- #Aidan's code
- hour = input("Set the hour you want your reminder for (use military time/24 hour clock)")
- min = input("Set the minute you want your reminder for")
- from datetime import datetime
- from threading import Timer
- import time
- x=datetime.today() #Takes the current time and stores it in the variable x
- y=x.replace(day=x.day+1, hour=hour, minute=min, second=0, microsecond=0)#creates a variable 'y' and sets the time of when you want to be reminded
- delta_t=y-x # this variable takes the set time and subtracts it from the current time in order to get the time remaining
- secs=delta_t.seconds+1
- while secs > 0:
- secs -=1
- time.sleep(1)
- sound()
- timer_for_sound()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement