I'm using appjar
to create a python app that includes the feature to set an alarm to go off at a certain time/date. However, based on my simple implementation, when calling the alarm function in the code the application will just infinitely wait for the alarm to go off before allowing anything else to happen.
I want to be able to navigate around the app without it having to wait on the alarm. What is the best way to go about doing this?
Here is my alarm code:
def setAlarm(year, month, day, hour, minute, second):
now = datetime.datetime.now()
date = datetime.date(year, month, day)
time = datetime.time(hour, minute, second)
alarmTime = datetime.datetime(year, month, day, hour, minute, second)
while now < alarmTime:
print("not yet")
mixer.music.load('Alarm.wav')
mixer.music.play(-1)
sound = True
while(sound):
print("Alarm")