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

Function selectFilename

Code/mainWindows.py:97–112  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

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

Callers 1

ButtonImageFunction · 0.70

Calls 2

Canvas_Function · 0.70
showImageFunction · 0.70

Tested by

no test coverage detected