MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / selectFilename

Function selectFilename

pix2pix/mainWindows.py:101–116  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

99imagePath={"filename": ""}#保存点击事件之后的图片路径
100tkImage = ''
101def selectFilename(root):
102 # 选择open文件进行识别
103 global tkImage
104 #注意:选择的图片路径中不要包含中文,不然OpenCV读取图片的时候读取为空
105 image_path1 = filedialog.askopenfilename(title='选择文件进行识别')
106 print(image_path1)
107 if image_path1:
108 canvas0, canvas1, canvas2 = Canvas_(root)
109 img1 = cv2.imread(image_path1)
110 print(type(img1))
111 tkImage = showImage(img1)
112 canvas0.create_image(0, 0, anchor='nw', image=tkImage)
113 imagePath["filename"] = image_path1
114 print(imagePath["filename"])
115 else:
116 tkinter.messagebox.showwarning(title='警告',message='请选择文件')
117
118#关闭主界面时弹出的确认窗口
119def closeEvent(root):

Callers 1

ButtonImageFunction · 0.70

Calls 2

Canvas_Function · 0.70
showImageFunction · 0.70

Tested by

no test coverage detected