#This is basic Alarm Clock program.
Modules used in Alarm Clock project
#1 time
written as : import time
#This module provides various time-related functions.
along with time module localtime() method of Time module also used.
#localtime()
function takes the number of seconds passed since epoch{Period} as an argument and returns struct_time in local time.
In the project time.localtime().tm_hour convert seconds into current local hours.
Also, convert time.localtime().tm_min convert seconds into current local minutes.
#2 playsound
play sound in Python
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.
for playing sound in alarm clock.py
steps need to be followed
#Step 1: install playsound module by writing pip install playsound in WindowsPowerShell.
#Step 2: import playsound module in Alarm_clock.py by writing from playsound import playsound
#Step 3: Download alarm ringtone using link "https://freetone.org/ringtones/melodies/alarm_clock_nice-10516"
#Step 4: In the line 14 of the code where playsound is written:
playsound(r'here you need to write the path where the above ringtone is downloaded')
for example: playsound(r'C:\Users\HP\Downloads\13767_nice_larm_clock.mp3')
Alarm will ring at your given time setting.
**Working of Program**
This script is the basic program using time module of Python
when you input hours and minutues for alarm to ring at that respective time alarm will ring
##This script is the basic program using time module of python
Screenshot of the output:
Name of Author: Pratima Kushwaha