Alarm Clock using Python Tkinter
In this tutorial, we are going to make an Alarm Clock in Python with GUI. We will use Tkinter for GUI. Now let's go:
Alarm Clock in Python Programming
Alarm Clock in Python with GUI
In this python project, we will use the Tkinter module to make an Alarm Clock in Python with GUI. Alarm Clock Project in Python Programming. Python Project for beginners. Python Project Alarm Clock.
Discover More
Code:-
from tkinter import *
from tkinter import messagebox
import time, sys
from pygame import mixer
from PIL import Image, ImageTk
def alarm():
alarm_time=user_input.get()
if alarm_time=="":
messagebox.askretrycancel("Error Message","Please Enter Value")
else:
while True:
time.sleep(1)
if (alarm_time==time.strftime("%H:%M")):
playmusic()
def playmusic():
mixer.init()
mixer.music.load('crock.mp3')
mixer.music.play()
while mixer.music.get_busy():
time.sleep(30)
mixer.music.stop()
sys.exit()
root=Tk()
root.title("Alarm Clock")
root.geometry("600x380")
canvas=Canvas(root,width=600,height=380)
image=ImageTk.PhotoImage(Image.open("bgimg.png"))
canvas.create_image(0,0,anchor=NW,image=image)
canvas.pack()
header=Frame(root)
box1=Frame(root)
box1.place(x=250,y=180)
box2=Frame(root)
box2.place(x=250,y=260)
#Time taken by User as Input
user_input=Entry(box1,font=('Arial Narrow',20),width=8)
user_input.grid(row=0,column=2)
#Set Alarm Button
start_button=Button(box2,text="Set Alarm",font=('Arial Narrow',16,'bold'),command=alarm)
start_button.grid(row=2,column=2)
root.mainloop()
If you want to download this code then let me know through my social media.
Conclusion:
We have created the Alarm Clock Project in Python Programming with GUI. Alarm Clock Python Project with GUI. Simple Python Projects.
You should also check out, Django Developer Roadmap, Python Developer Roadmap, C++ Complete Roadmap, Machine Learning Complete Roadmap, Data Scientist Learning Roadmap, R Developer Roadmap, DevOps Learning Roadmap, and Laravel Developer Roadmap.
Thank you for reading this blog. I wish you the best in your journey in learning and mastering Python Programming.
Follow me to receive more useful content:
Instagram | Twitter | Linkedin | Youtube
Thank you