Я хочу начать с папки, например, C: \ test \ вместо любой из предопределенных папок CSIDL _ *.Как мне этого добиться?
''' python 3.6.2 '''
import os
import win32gui
from win32com.shell import shell, shellcon
myfolder_pidl = shell.SHGetFolderLocation (0, shellcon.CSIDL_DESKTOP, 0, 0)
pidl, display_name, image_list = shell.SHBrowseForFolder (
win32gui.GetDesktopWindow (),
myfolder_pidl,
"Select a file or folder",
0x00014050, #shellcon.BIF_BROWSEINCLUDEFILES and some more
None,
None
)
if (pidl, display_name, image_list) == (None, None, None):
print ('Nothing selected')
else:
my_path = shell.SHGetPathFromIDList (pidl)
file_to process = my_path.decode()
''' continue processing file_to_process
'''