我很难用PAGE GUI Generator将图像加载到标签中。以下是我的用户界面:
每次我单击“浏览文档”按钮时,它都会调用一个open_file_dialog_function
,下面是该函数:
def open_file_dialog(self):
self.filename = filedialog.askopenfilename(initialdir = "/", title = "Select A File", filetype = (("jpeg", "*.jpg"), ("All Files", "*.*")))
#Display Document Path
self.label_document_path1 = ttk.Label(self.label_document_path, text = "")
self.label_document_path1.grid(column = 1, row = 2)
self.label_document_path1.configure(text = self.filename)
#Load Damaged Document
load = Image.open(self.filename)
render = ImageTk.PhotoImage(load)
self.label_input_document1 = ttk.Label(self.label_input_document, image = render)
self.label_input_document1.grid(column = 1, row = 3)
self.label_input_document1.configure(image = render)
每次执行该功能时,它只会在假定的图像中显示白色。为什么?请帮助我。