我是python的新手,我正在尝试将从文件选择器中选取的文件保存到图像文件夹。
下面是一些代码:
def open_file(self):
root = tk.Tk()
# hides tk main window
root.withdraw()
canvas1 = tk.Canvas(root, width=0, height=0)
canvas1.pack()
self.jpg = filedialog.askopenfilename(initialdir="/", title="Select file",
filetypes=(("jpeg files", "*.jpg"), ("all files", "*.*")))
FrameDesign.selected(self, self.jpg)
root.destroy()
return self.jpg
# path = 'C:/Users/AJONES2/Desktop/img'
# fullpath = os.path.join(path, filename)
img.save('C:/Users/AJONES2/Documents/img', 'JPEG')