|
| 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 | + |
0 commit comments