win32ui CreateFileDialog Can't Set Dir

Roger Upole rupole at hotmail.com
Tue Oct 28 01:37:54 EST 2003


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

"EricP" <fordphoto2020NOSPAM at yahoo.comNOSPAM> wrote in message
news:1Dknb.31818$mZ5.158181 at attbi_s54...
> 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
>
>






More information about the Python-list mailing list