def del_buff(i): answer, person_buf = db.search_person("bufer") if answer: for f in person_buf.face: db.del_face(f) FaceAlgo.clear_noname()
def WindowfPersonRefresh(person): global frame4, e_name, e_second_name, t, page_win_person # обновляем данные на окне e_name.delete(0, END) e_name.insert(END, person.name) row_c=0 col_c=0 c=0 listbox_faces.delete(0,END) list = frame4.grid_slaves() for l in list: l.destroy() count_faces=0 for face in person.face: #print(page_win_person*max_in_page, page_win_person*max_in_page+max_in_page) if count_faces>=page_win_person*max_in_page and count_faces<page_win_person*max_in_page+max_in_page: try: listbox_faces.insert(END, face) frame = cv2.imread(face.image_path) height, width = frame.shape[:-1] if height>0 and width>0: frame = cv2.resize(frame, (115, 115), interpolation=cv2.INTER_CUBIC) cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) img = Image.fromarray(cv2image) #imgtk = ImageTk.PhotoImage(image=img) #img = ImageTk.PhotoImage(Image.open(face.image_path)) img = ImageTk.PhotoImage(image=img) #print(face.image_path) #panel = Label(t, image=img) #panel = Label(t, text = face.image_path) panel = Button(frame4, image=img, command=lambda i=c: onClick(i)) #panel = Button(t, image=img, text=c) #panel.bind('<Button-1>', push_image) panel.image = img panel.grid(row=row_c, column=col_c, sticky=(N, W, E, S)) col_c+=1 if col_c>6: col_c=0 row_c+=1 c+=1 except: print("ошибка вывода картинки", face.image_path ) db.del_face(face) count_faces+=1 listbox_faces.grid(row=0, column=0, padx=10, pady=10) return
def onDel(person): global listbox_faces # переносим из bufer в выбранный профиль answer, person_buf = db.search_person("bufer") if answer: for f in person_buf.face: db.del_face(f) WindowfPersonRefresh(person)
def refesh_persone(): global all_person, person, selected_persone, max_in_page, listbox_faces, frame5,frame6, page_win_person_main, panel, present #page_win_person_main = read_page() if present == False: panel.destroy() if selected_persone: print("page_win_person", page_win_person_main) e_name.delete(0, END) e_name.insert(END, person.name) but_step1 = Button(frame5, text='<<', command=lambda i=-1: page_change(i)).grid(row=5, column=0, sticky=(N, W, E, S)) but_step2 = Button(frame5, text='>>', command=lambda i=1: page_change(i)).grid(row=6, column=0, sticky=(N, W, E, S)) but_cut = Button(frame5, text='Вырезать', command=onCut).grid(row=2, column=0, sticky=(N, W, E, S)) but_paste = Button(frame5, text='Вставить', command=onPaste).grid(row=1, column=0, sticky=(N, W, E, S)) row_c = 0 col_c = 0 c = 0 listbox_faces.delete(0, END) list = frame6.grid_slaves() for l in list: l.destroy() count_faces = 0 for face in person.face: # print(page_win_person*max_in_page, page_win_person*max_in_page+max_in_page) if count_faces >= page_win_person_main * max_in_page and count_faces < page_win_person_main * max_in_page + max_in_page: try: listbox_faces.insert(END, face) frame = cv2.imread(face.image_path) height, width = frame.shape[:-1] if height > 0 and width > 0: frame = cv2.resize(frame, (115, 115), interpolation=cv2.INTER_CUBIC) cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) img = Image.fromarray(cv2image) # imgtk = ImageTk.PhotoImage(image=img) # img = ImageTk.PhotoImage(Image.open(face.image_path)) img = ImageTk.PhotoImage(image=img) #print(face.image_path, c) # panel = Label(t, image=img) # panel = Label(t, text = face.image_path) panel = Button(frame6, image=img, command=lambda i=c: onClick(i)) # panel = Button(t, image=img, text=c) # panel.bind('<Button-1>', push_image) panel.image = img panel.grid(row=row_c, column=col_c, sticky=(N, W, E, S)) col_c += 1 if col_c > 6: col_c = 0 row_c += 1 c += 1 except: print("ошибка вывода картинки", face.image_path) db.del_face(face) count_faces += 1 listbox_faces.grid(row=0, column=0, padx=10, pady=10)
def del_buff(): print("Чистим буфер") answer, person_buf = db.search_person("bufer") if answer: for f in person_buf.face: db.del_face(f)