Skip to content

Commit 711b76f

Browse files
committed
changes updated
1 parent 12ca0f5 commit 711b76f

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed
Loading
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#This is basic Alarm Clock program.<br>
2+
3+
**Modules used in Alarm Clock project**<br>
4+
#1 time<br>
5+
written as : import time<br>
6+
#This module provides various time-related functions.<br>
7+
<br>
8+
9+
along with time module localtime() method of Time module also used.
10+
#localtime()<br>
11+
function takes the number of seconds passed since epoch{Period} as an argument and returns struct_time in local time.<br>
12+
<br>
13+
In the project **time.localtime().tm_hour** convert seconds into current local hours.<br>
14+
<br>
15+
Also, convert **time.localtime().tm_min** convert seconds into current local minutes.<br>
16+
<br>
17+
#2 playsound
18+
**play sound in Python**
19+
<br>
20+
It requires one argument - the path to the file with the sound you’d like to play. This may be a local file, or a URL. In the project I use local file.<br>
21+
<br>
22+
**for playing sound in alarm clock.py**<br>
23+
steps need to be followed
24+
<br>
25+
#Step 1: install playsound module by writing pip install playsound in WindowsPowerShell.<br>
26+
<br>
27+
#Step 2: import playsound module in Alarm_clock.py by writing **from playsound import playsound**<br>
28+
<br>
29+
#Step 3: Download alarm ringtone using link "https://freetone.org/ringtones/melodies/alarm_clock_nice-10516"<br>
30+
<br>
31+
#Step 4: In the line 14 of the code where playsound is written:
32+
playsound(r'here you need to write the path where the above ringtone is downloaded')<br>
33+
for example: *****playsound(r'C:\Users\HP\Downloads\13767_nice_larm_clock.mp3')*****<br>
34+
<br>
35+
## Program is now ready to go with sound <br>
36+
37+
<br>
38+
Alarm will ring at your given time setting.<br>
39+
<br>
40+
**Working of Program**<br>
41+
42+
This script is the basic program using time module of Python<br>
43+
when you input hours and minutues for alarm to ring at that respective time alarm will ring<br>
44+
<br>
45+
##This script is the basic program using **time** module of python<br>
46+
<br>
47+
***Screenshot of the output:***
48+
<p align="center"><img src="https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/GUIScripts/Age%20Calculator%20WebApp/Age.gif">"</p>
49+
<br>
50+
Name of Author: Pratima Kushwaha
51+
52+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#importing playsound module pip install playsound
2+
import time
3+
from playsound import playsound
4+
#input hr(hours) and min(minutes) with am or pm
5+
hr = int(input("Enter hour: "))
6+
min = int(input("Enter minutes: "))
7+
amPm=str(input("am or pm"))
8+
#n=1 and condition always be true
9+
n=1
10+
while n>0:
11+
#here local hour is compare with given input hr(hour) and local minute is compare with given input min(minutes)
12+
if time.localtime().tm_hour == hr and time.localtime().tm_min == min:
13+
print("wake up!!!")
14+
playsound(r'C:\Users\HP\Downloads\13767_nice_larm_clock.mp3')#here path of alarm tune using playsound module
15+
break #when time match wake up!!! print with sound
16+
else:
17+
n+=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
##requirement
2+
3+
**time module**
4+
5+
**playsound module**

0 commit comments

Comments
 (0)