win32ui CreateFileDialog Can't Set Dir

E

EricP

I get the following error when I run this script to open a file dialog.
I've searched the web and news groups for this issue and have not found any
references. I get the same behavior when I run it from Python or Pythonwin.
I'm new to win32... and would appreciate any help I can get.

If I comment out the following line it works fine but I have to navigate to
my initial directory.....

pd.SetOFNInitialDir = r'D:\Documents and Settings\John'




# File Dialog Example
import win32ui
import win32con
pd = win32ui.CreateFileDialog(1)
pd.SetOFNInitialDir = r'D:\Documents and Settings\John'
pd.DoModal()
print 'filename =',pd.GetFileName()
print 'path =', pd.GetPathName()
pd=None


Traceback (most recent call last):
File "filedialog.py", line 4, in ?
pd.SetOFNInitialDir = 'D:\Documents and Settings\Eric'
TypeError: PyCFileDialog has read-only attributes


Also is there a way to open the XP file dialog that has the navigation
shortcuts on the left side of the dialog window?

Thanks
Eric
 
R

Roger Upole

SetOFNInitialDir is a method:
pd.SetOFNInitialDir(r'D:\Documents and Settings\John')
hth
Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top