Oct-10-2022, 06:38 PM
I think I understand your example. It prints the reminder 5sec from the time you started the program. Correct?
But I'm still confused on how to make my reminders work where they execute on their set dates & times.
When the reminder's date & time == the currentdate & currenTime I want to trigger the reminderPopup(), but how would the scheduler know when the reminder's date/time == the current date/time?
But I'm still confused on how to make my reminders work where they execute on their set dates & times.
When the reminder's date & time == the currentdate & currenTime I want to trigger the reminderPopup(), but how would the scheduler know when the reminder's date/time == the current date/time?
import sched import time import sqlite3 from BX_External_Functions import checkForReminders, reminderPopup from BX_Constants import MainDatabase, currentdate, currentTime #Create schedule scheduler = sched.scheduler(time.time, time.sleep) #Read in reminders from database # Connect to the database connection = sqlite3.connect(MainDatabase) cursor = connection.cursor() # Get the Reminder & it's scheduled Date & Time cursor.execute("SELECT Reminder, Date, Time FROM Reminders") Results = cursor.fetchall() connection.commit() connection.close() #For each reminder, add an event to the schedule (enter/enterabs) for row in Results: print(row) scheduler.enterabs() #How would I add the reminder as an event that triggers on it's set date/time? #If a new reminder is created, add it to the database & add an event to the schedule #Inside Baxter's while True loop, call schedule.run(blocking=False) print ('Checking for reminders...') scheduler.run(False)