-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 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,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("") |