win32ui CreateFileDialog Can't Set Dir

Discussion in 'Python' started by EricP, Oct 28, 2003.

  1. EricP

    EricP Guest

    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
     
    EricP, Oct 28, 2003
    #1
    1. Advertising

  2. EricP

    Roger Upole Guest

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

    "EricP" <> wrote in message
    news:1Dknb.31818$mZ5.158181@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
    >
    >
     
    Roger Upole, Oct 28, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UnVkeQ==?=

    Sub Dir, Virtual dir, what do I use?

    =?Utf-8?B?UnVkeQ==?=, Jun 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    450
    =?Utf-8?B?UnVkeQ==?=
    Jun 12, 2005
  2. MsKitty
    Replies:
    3
    Views:
    458
    Thomas Ganss
    Apr 29, 2005
  3. Joey C.
    Replies:
    2
    Views:
    340
    Joey C.
    Nov 19, 2005
  4. Matthew Denner
    Replies:
    1
    Views:
    220
  5. Kga Agk
    Replies:
    2
    Views:
    169
    Kga Agk
    Jun 29, 2009
Loading...

Share This Page