Alarm Clock Using Python With Source Code
The Alarm Clock Using Python is a project that written in python programming language, The objective of this Python Alarm Clock Tutorial is to implement an Python Alarm Clock GUI.
A Python Alarm Clock Script consists of very useful libraries such as datetime and tkinter which help us to build project using the current date and time. Apart from this, they provide a user interface to set the alarm according to the requirement in 24-hour format.
Watch the video to see the full running Alarm Clock Using Python Project.
This article Python Alarm Clock also includes a downloadable Python Alarm Clock Code for free. To start creating this simple project Alarm Clock Using Python, make sure that you have Pycharm IDE installed in your computer.
Steps on how to create a Alarm Clock Using Python.
Alarm Clock Using Python With Source Code
- Step 1: Create a project name.
First open Pycharm IDE and then create a “project name” after creating a project name click the “create” button.
- Step 2: Create a python file.
Second after creating a project name, “right click” your project name and then click “new” after that click the “python file“.
- Step 3: Name your python file.
Third after creating a python file, Name your python file after that click “enter“.
- Step 4: The actual code.
You are free to copy the code given below and download the full source code below.
The Code Given Below Is For Importing Modules.
1 2 3 4 |
from tkinter import * import datetime import time import winsound |
In the given code which is importing all module that being called in executing the program.
The Code Given Below Is For The Module Actual Time.
1 2 3 |
def actual_time(): set_alarm_timer = f"{hour.get()}:{min.get()}:{sec.get()}" alarm(set_alarm_timer) |
In this module which is the actual or the current time that being called when setting the alarm.
The Code Given Below Is For The Module Of Setting The Alarm.
1 2 3 4 5 6 7 8 9 10 11 12 |
def alarm(set_alarm_timer): while True: time.sleep(1) current_time = datetime.datetime.now() now = current_time.strftime("%H:%M:%S") date = current_time.strftime("%d/%m/%Y") print("The Set Date is:",date) print(now) if now == set_alarm_timer: print("Time to Wake up") winsound.PlaySound("sound.mp3",winsound.SND_ASYNC) break |
In this module which is the setting of alarm that being executed.
The Code Given Below Is For The GUI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
clock = Tk() clock.title("DataFlair Alarm Clock") clock.geometry("400x200") time_format=Label(clock, text= "Enter time in 24 hour format!", fg="red",bg="black",font="Arial").place(x=60,y=120) addTime = Label(clock,text = "Hour Min Sec",font=60).place(x = 110) setYourAlarm = Label(clock,text = "When to wake you up",fg="blue",relief = "solid",font=("Helevetica",7,"bold")).place(x=0, y=29) # The Variables we require to set the alarm(initialization): hour = StringVar() min = StringVar() sec = StringVar() #Time required to set the alarm clock: hourTime= Entry(clock,textvariable = hour,bg = "pink",width = 15).place(x=110,y=30) minTime= Entry(clock,textvariable = min,bg = "pink",width = 15).place(x=150,y=30) secTime = Entry(clock,textvariable = sec,bg = "pink",width = 15).place(x=200,y=30) #To take the time input by user: submit = Button(clock,text = "Set Alarm",fg="red",width = 10,command = actual_time).place(x =110,y=70) clock.mainloop() #Execution of the window. |
In this module which is the design or the graphical user interface or (GUI) of this project.
Complete Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#Importing all the necessary libraries to form the alarm clock: from tkinter import * import datetime import time import winsound def alarm(set_alarm_timer): while True: time.sleep(1) current_time = datetime.datetime.now() now = current_time.strftime("%H:%M:%S") date = current_time.strftime("%d/%m/%Y") print("The Set Date is:",date) print(now) if now == set_alarm_timer: print("Time to Wake up") winsound.PlaySound("sound.mp3",winsound.SND_ASYNC) break def actual_time(): set_alarm_timer = f"{hour.get()}:{min.get()}:{sec.get()}" alarm(set_alarm_timer) clock = Tk() clock.title("DataFlair Alarm Clock") clock.geometry("400x200") time_format=Label(clock, text= "Enter time in 24 hour format!", fg="red",bg="black",font="Arial").place(x=60,y=120) addTime = Label(clock,text = "Hour Min Sec",font=60).place(x = 110) setYourAlarm = Label(clock,text = "When to wake you up",fg="blue",relief = "solid",font=("Helevetica",7,"bold")).place(x=0, y=29) # The Variables we require to set the alarm(initialization): hour = StringVar() min = StringVar() sec = StringVar() #Time required to set the alarm clock: hourTime= Entry(clock,textvariable = hour,bg = "pink",width = 15).place(x=110,y=30) minTime= Entry(clock,textvariable = min,bg = "pink",width = 15).place(x=150,y=30) secTime = Entry(clock,textvariable = sec,bg = "pink",width = 15).place(x=200,y=30) #To take the time input by user: submit = Button(clock,text = "Set Alarm",fg="red",width = 10,command = actual_time).place(x =110,y=70) clock.mainloop() #Execution of the window. |
Output

Run Quick Virus Scan for secure Download
Run Quick Scan for secure DownloadDownloadable Source Code
I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.
Objective
The objective of this project Alarm Clock Using Python is to implement an alarm clock using Python. Python consists of very useful libraries such as datetime and tkinter which help us to build project using the current date and time. Apart from this, they provide a user interface to set the alarm according to the requirement in 24-hour format.
Related Articles
- Currency Converter In Python With Source Code
- ATM Program In Python With Source Code
- Registration Form In Python With Source Code
- Python MySQL UPDATE Query: Step-by-Step Guide in Python
- Bank Management System Project in Python With Source Code
- Python MySQL INSERT Query: Step by Step Guide in Python
- How To Make Game In Python With Source Code
- Complaint Management System Source Code In PHP
Inquiries
If you have any questions or suggestions about Alarm Clock Using Python , please feel free to leave a comment below.