Skip to content

Commit

Permalink
you'll never forget this
Browse files Browse the repository at this point in the history
  • Loading branch information
Okmeque1 authored May 30, 2024
1 parent dd82422 commit d61f6fe
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions PythonSoft/Utilities/alarm clock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import time
import os
import winsound
input("To activate the alarm function, press CTRL-C. Press ENTER to activate the program...")
def almclock(alarm):
print(f"The alarm will ring at {alarm}")
try:
while True:
print(str(time.asctime()),end='\r')
if time.asctime() == alarm:
break
except KeyboardInterrupt:
print(" ")
clearscreen()
alarm += input("Enter a day. The format must be the first 3 letters of the day with the first letter a capitalized : ") + " "
alarm += input("Enter a month. The format must be the first 3 letters of the month with the first letter capitalized : ") + " "
alarm += input("Enter a day from 01 to 30 or 31 depending on the month. The format must be with 2 digits. If the day is 0-9, you must type 09, 04, 01 and the rest you type it normally : ") + " "
alarm += input("Enter an hour from 00 to 23. The format must be with 2 digits. If the hour is 00-09, you must type 00, 04, 09 and the rest you type it normally : ") + ":"
alarm += input("Enter a minute from 00-59. The format must be with 2 digits. If the minute is 00-09, you must type it 00, 04, 09 and the rest you type it normally : ") + ":"
alarm += input("Enter a second. Same rules as the minutes. If you don't know what that is then you can't read : ") + " "
alarm += input("Enter a year : ")
clearscreen()
almclock(alarm)
end()
def clearscreen():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
def end():
if os.name == 'nt':
while True:
winsound.Beep(440,250)
time.sleep(0.25)
else:
os.system('play -nq -t alsa synth 0.1 sine 440')
almclock("")

0 comments on commit d61f6fe

Please sign in to comment.