импорт ОС из tkinter импорт * из tkinter import filedialog как filedialog
GUI_root = Tk () GUI_root.title ('HMDUFR')
GUI_root.geometry ('1000x500') GUI_root. minsize (300,300) GUI_root.maxsize (1500,1500) GUI_root.configure (background = 'grey')
title_label = Метка (GUI_root, text = 'ОБНАРУЖЕНИЕ ЧЕЛОВЕЧЕСКОЙ ЭМОЦИИ С ИСПОЛЬЗОВАНИЕМ ЛИЦЕВОГО ПРИЗНАНИЯ', bg = 'blue', fg = 'white', шрифт = 'Castellar 15, полужирный', ширина полосы = 3, рельеф = RIDGE) .pack (fill = X)
l1 = Label (text = 'Open File', bg = 'серый ', высота =' 1 ', ширина =' 10 ', fg =' черный ', шрифт =' Timesnewroman 10 курсив ', рельеф = SUNKEN) .pack (side = LEFT, якорь = NW)
def openfile (): filename = filedialog.askopenfile (parent = GUI_root, title = 'Выбрать файл', initialdir = 'C: \') Name.set (fileName) Имя = StringVar (Нет) filepath = Entry (GUI_root, width= 50, textvariable = custName) .pack (side = LEFT, anchor = NW) b1 = кнопка (text = 'Browse', высота = '1', ширина = '10', рельеф = RAISED, курсор = 'hand2',command = openfile) .pack (side = LEFT, anchor = NW) GUI_root.mainloop ()