A simple command-line alarm clock built with Python.
I created this project while practicing Python and working with time handling, user input, audio playback, and keyboard input.
The program allows the user to set an alarm time and plays an alarm sound when the specified time is reached.
- Displays the current time
- Allows the user to set an alarm
- Continuously checks the current time
- Plays an alarm sound when the alarm time is reached
- Allows the alarm to be stopped using the keyboard
- Python 3
datetimetimepygamemsvcrt
Install pygame before running the program:
pip install pygameClone the repository:
git clone https://github.com/ahmedraza-devs/python-alarm-clock.gitOpen the project folder:
cd python-alarm-clockInstall the required library:
pip install pygameRun the program:
python alarm_clock.pyWhen prompted, enter the alarm time in this format:
HH:MM:SS AM/PM
Example:
09:30:00 PM
python-alarm-clock/
│
├── alarm_clock.py
├── A Stroll - The Grey Room _ Density & Time.mp3
└── README.md
The MP3 file is used by the program as the alarm sound and is kept in the same directory as the Python script.
This project is part of my Python learning journey. It helped me practice working with modules, functions, loops, user input, date and time, audio playback, and basic program control.
Ahmed Raza