'Reminders inside a task manager
This is my program. My problem is I would like my reminders to go off on their respective times without having to go through the program first. But they aren't going off until after the program questions have been answered.
import pip
import time
from datetime import datetime
def main():
Start = input('Is the schedule finished? ')
if Start == ('yes'):
print('Start sending emails')
for i in range(1):
time.sleep(10)
question = input('Have you finished day one emails? ')
if question == ('no'):
print('Finish emails by 0830.')
time.sleep(10)
question = input('Have you finished day one emails? ')
if question == ('no'):
print('Finish emails by 0830.')
time.sleep(10)
question = input('Have you finished day one emails? ')
if question == ('no'):
print("You're going to fall behind.")
elif question == ('yes'):
print('Start day two.')
elif question == ('yes'):
print('Start day two.')
elif Start == ('no'):
print('Finish schedule')
reminders = [
# Put all of your reminders here
# Drink water notification would be set multiple times
('2022-02-19 22:12:00', 'Eat Lunch'),
('2022-02-19 22:13:00', 'Drink water')
]
reminders2 = {datetime.fromisoformat(reminder[0]).timestamp(): reminder[1] for reminder in reminders}
while True:
now = time.time()
for timestamp, reminder_msg in reminders2.items():
if timestamp < now:
print(reminder_msg)
del reminders2[timestamp]
break
time.sleep(1)
main()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
