python的tkinter打开文件和文件夹
import tkinter as tk
from tkinter import filedialog
print('请选择文件夹')
root = tk.Tk()
root.withdraw()
rootpath = filedialog.askdirectory()
print('文件夹选择完毕,路径为:',rootpath)
print('请选择图片')
waterpath = filedialog.askopenfilename()
print('水印图片选择完毕,路径为:',waterpath)
from tkinter import filedialog
print('请选择文件夹')
root = tk.Tk()
root.withdraw()
rootpath = filedialog.askdirectory()
print('文件夹选择完毕,路径为:',rootpath)
print('请选择图片')
waterpath = filedialog.askopenfilename()
print('水印图片选择完毕,路径为:',waterpath)
评论