You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/WPy32-3720/python-3.7.2/Lib/site-packages/win32/Demos/GetSaveFileName.py

37 lines
1.1 KiB

import win32gui, win32con, os
filter='Python Scripts\0*.py;*.pyw;*.pys\0Text files\0*.txt\0'
customfilter='Other file types\0*.*\0'
fname, customfilter, flags=win32gui.GetSaveFileNameW(
InitialDir=os.environ['temp'],
Flags=win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER,
File='somefilename', DefExt='py',
Title='GetSaveFileNameW',
Filter=filter,
CustomFilter=customfilter,
FilterIndex=1)
print('save file names:', repr(fname))
print('filter used:', repr(customfilter))
print('Flags:', flags)
for k,v in list(win32con.__dict__.items()):
if k.startswith('OFN_') and flags & v:
print('\t'+k)
fname, customfilter, flags=win32gui.GetOpenFileNameW(
InitialDir=os.environ['temp'],
Flags=win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER,
File='somefilename', DefExt='py',
Title='GetOpenFileNameW',
Filter=filter,
CustomFilter=customfilter,
FilterIndex=0)
print('open file names:', repr(fname))
print('filter used:', repr(customfilter))
print('Flags:', flags)
for k,v in list(win32con.__dict__.items()):
if k.startswith('OFN_') and flags & v:
print('\t'+k)