mirror of
https://github.com/Death916/deathclock.git
synced 2026-04-10 03:04:40 -07:00
base of reflex re write. centered clock and weather
This commit is contained in:
parent
aba3a7b641
commit
3bec50f40e
24 changed files with 1563 additions and 6838 deletions
27
utils/alarm.py
Normal file
27
utils/alarm.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#alarm.py
|
||||
# alarm component for dash app
|
||||
|
||||
from dash import html, dcc
|
||||
import datetime
|
||||
import time
|
||||
|
||||
class Alarm:
|
||||
def __init__(self):
|
||||
self.current_time = datetime.datetime.now()
|
||||
self.alarms = []
|
||||
self.alarm_times = []
|
||||
|
||||
|
||||
def add_alarm(self, alarm_time,current_time):
|
||||
self.alarms.append(alarm_time)
|
||||
|
||||
self.current_time = current_time
|
||||
|
||||
print(f"Alarm set for {alarm_time}")
|
||||
|
||||
def check_alarm(self):
|
||||
current_time = datetime.datetime.now()
|
||||
if current_time.time() in self.alarm_times:
|
||||
print("Alarm triggered!")
|
||||
return True
|
||||
return False
|
||||
Loading…
Add table
Add a link
Reference in a new issue