I am trying to make a alarm clock in python using tkinter. I have a problem with import winsound module. I was wondering if anyone could help me.
Here is the code and error message:
from tkinter import *
from tkinter.messagebox import *
from tkinter.ttk import *
MainWindow.title("Alarm clock by PythonGeeks")
showinfo("notification", "alarm has been set")
if x == datetime.datetime.now().hour and y == datetime.datetime.now().minute:
for j in range(0,100):
label3=Label(MainWindow,text="AM OR PM:")
@emer2020 it should be working, since you have import winsound. When I mean windows are you using Windows OS? That’s all winsound runs with. If you are change the Categorie to Bug Reports since it should work with what I know.
I would not recommend making an alarm clock on Replit. If you get sound to work (which I’m told that sound in Python on Replit can be tricky at times), the Repl will still not stay always on. Even “always on” merely turns your Repl back on when it shuts off, but the shut off would reset your program (unless you hardcoded it), thus preventing the alarm from sounding at the designated time and thereby not waking you up (or whatever you’re using it for). AFAIK, deployments will still reboot as well. Now, coding a Python alarm clock to work on your PC (such as Windows) would be a fun way to wake up in the morning. It is a cool idea; I just wanted to let you know the potential issues with using Replit for this particular project.
That is brilliant. Using that, we could then make the alarm ring if the time is between x and y (to ensure that if it reboots at the designated time it would still go off), it would work. x and y can be the time and the time + a designated amount of time. Thank you for that idea.