|
|
@ -42,20 +42,6 @@ def select_image(root, img_container):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
messagebox.showerror("错误", "没有选择图片路径")
|
|
|
|
messagebox.showerror("错误", "没有选择图片路径")
|
|
|
|
|
|
|
|
|
|
|
|
def show_selected_image(root, img_container):
|
|
|
|
|
|
|
|
if 'file_path' in img_container:
|
|
|
|
|
|
|
|
img_path = img_container['file_path']
|
|
|
|
|
|
|
|
img = Image.open(img_path)
|
|
|
|
|
|
|
|
img.thumbnail((800, 800))
|
|
|
|
|
|
|
|
img_tk = ImageTk.PhotoImage(img)
|
|
|
|
|
|
|
|
if 'img_label' not in img_container:
|
|
|
|
|
|
|
|
img_container['img_label'] = tk.Label(root)
|
|
|
|
|
|
|
|
img_container['img_label'].pack(side=tk.TOP, pady=10)
|
|
|
|
|
|
|
|
img_container['img_label'].configure(image=img_tk)
|
|
|
|
|
|
|
|
img_container['img_label'].image = img_tk
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
messagebox.showerror("错误", "没有选择图片路径")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def change_size(event, img, label_pic):
|
|
|
|
def change_size(event, img, label_pic):
|
|
|
|
img_aspect = img.shape[1] / img.shape[0]
|
|
|
|
img_aspect = img.shape[1] / img.shape[0]
|
|
|
|
new_aspect = event.width / event.height
|
|
|
|
new_aspect = event.width / event.height
|
|
|
|