#Lazr60+ thanks man for the help but actually the program has to wait for some days where the program could be stoped in between the intervals of days ...For suppose if I have to run fun1 after 7 days and the program will be closed 1, 2 times and again started and will the program still run fun1? plz
from tkinter import * from datetime import datetime, timedelta import pickle from tkinter import messagebox filename = "file.pk" #filename data stored as dic = {time:[name,item]} root = Tk() t = IntVar() i = StringVar() n = StringVar() def Notification_On_Completing(n, i, t): return messagebox.showinfo("Completed", "Name:- {}, Item:-{}, in Days:-{}".format(n, i, t)) def Check_If_Time_Is_Over(): #my actual problem is in this function with open(filename, "rb") as f: dic = pickle.load(f) now = datetime.now() for i, j in dic: #trying to loop and check if the time == now() if i == now: Notification_On_Completing(j[0], j[1], i) #if its true return the key which is equal with its value elif i =! now: #if now time i am tryinng to show how much time left print(i - now, "Time has left for name:-{}, item:-{}".format(j[0],j[1])) else: root.after(10000, Check_If_Time_Is_Over) def SaveTheDaysToNotify(): now = datetime.now() time = t.get() # days to wait beforer notifying item = i.get() #item name name = i.get() #name end = now + timedelta(days=time) #adding today with the number of days to notify with open(filename.pk, "rb") as f: # avoiding the overide of the files dic = pickle.load(f) dic= {end:[name, item]} # saving a days to notify as dic which will also show the name , and item with open("file.pk", "wb") as f: #keeping record of the time time to notify pickle.dump(dic, f) Check_If_Time_Is_Over() #Gui starts from here time1 = Entry(root,textvariable=t).pack() #taking entry as of time, name and item name1 = Entry(root,textvariable=n).pack() item1 = Entry(root, textvariable=i).pack() ss = Button(root,text="done",command=clicked).pack() #adding to the pickle database with format as dictionary as dic ={time:[name, item]} root.mainloop() Check_If_Time_Is_Over() if __name__ == "__main__": main_()this is what i tried......plz i need help