def fetch(self,entries): values = [] for entry in entries: field = entry[0] text = entry[1].get() values.append(text) tree.insert("", END, text="New Event",values=(values[0], values[1], values[2], values[3]), tags=('ttk', 'simple')) post = {"Description": values[0],"Date": values[1], "Hours": values[2],"Alert": values[3]} posts = db.posts post_id = posts.insert_one(post).inserted_id db.nn(self)
def lollo(self): global label label.configure(text=time.asctime()) d = datetime.datetime.now() b=db.nn(self) print("New Event") for post in b: for attr in [ 'year', 'month', 'day', 'hour', 'minute', 'second', 'microsecond']: print (attr, ':', getattr(d, attr)) year=getattr(d, 'year') month=getattr(d, 'month') day=getattr(d, 'day') hour=getattr(d, 'hour') minute=getattr(d, 'minute') if (int(post['Hours']) == int(minute)) and (int(post['Hours']) == int(minute)): print( ':xcxdsdssdsdsdsddddddnnnnnnnnnnnnnnnnnnnncxc') showinfo( "Answer", "Sorry, no answer available") frame.after(1000, self.lollo)
def retrive(self): a=db.re(self) json.dumps(a, default=json_util.default) self.lollo() v.set(a['Hours']) b=db.nn(self) print("New Event") for post in b: print(post)
def __init__(self, master): global v global tree global label global frame global cal frame = Frame(master, bd=1, relief=SUNKEN) frame.grid(row=0, column=0) logo = PhotoImage(file="oo.gif") ############ tree cration ############ tree =ttk.Treeview (frame) tree["columns"]=("Description","Date","Hours","Alert") tree.heading("Description", text="Description") tree.heading("Date", text="Date") tree.heading("Hours", text="Hours") tree.heading("Alert", text="Alert") label = Label(frame, text="fffff", width=30) label.pack() print( 'Now :', datetime.datetime.now()) print ('Today :', datetime.datetime.today()) print ('UTC Now:', datetime.datetime.utcnow()) d = datetime.datetime.now() for attr in [ 'year', 'month', 'day', 'hour', 'minute', 'second', 'microsecond']: print (attr, ':', getattr(d, attr)) ############ retrive db ############ b=db.nn(self) ############ insert_in tree ############ for post in b: tree.insert("" , END , image=logo, text=post['text'], values=(post['author'],post['tags'])) ############ insert_in tree ############ for index, item in enumerate(["one", "two", "three", "four"]): tree.insert("" , END, text=item, values=("1A","1b"), image=logo) ############ insert_in tree ############ tree.insert("", END, "dir3", text="Dir 3", image=logo) tree.insert("dir3", END, text=" sub dir 3",values=("3A",logo)) tree.pack() ############ bottom frame ############ framebt = Frame(master, bd=1, relief=SUNKEN) framebt.grid(row=1) ############ bottom frame Button ############ w1 = Label(framebt, image=logo, text="Close") w1.image = logo w1.pack(side = LEFT) self.Insert = Button(framebt, text="Insert", command=self.showsinsertwindow) self.Insert.pack(side = LEFT) self.Remove = Button(framebt, text="Remove", command=self.retrive) self.Remove.pack(side = LEFT) v = StringVar() self.w = Label(framebt, textvariable= v) self.w.pack(side = LEFT)