wxPython FileDialog, select folder

Discussion in 'Python' started by SMALLp, Dec 20, 2007.

  1. SMALLp

    SMALLp Guest

    How can i select folder either with wx.FileDialog or with any other. I
    managed to fine only how to open files but I need to select folder to
    get files from all sub folders.....

    Thanks in advance!
    SMALLp, Dec 20, 2007
    #1
    1. Advertising

  2. SMALLp

    Chris Mellon Guest

    On Dec 20, 2007 3:19 PM, SMALLp <-com.hr> wrote:
    > How can i select folder either with wx.FileDialog or with any other. I
    > managed to fine only how to open files but I need to select folder to
    > get files from all sub folders.....
    >



    There's a separate dialog, wx.DirDialog.
    Chris Mellon, Dec 20, 2007
    #2
    1. Advertising

  3. SMALLp

    SMALLp Guest

    Chris Mellon wrote:
    > On Dec 20, 2007 3:19 PM, SMALLp <-com.hr> wrote:
    >> How can i select folder either with wx.FileDialog or with any other. I
    >> managed to fine only how to open files but I need to select folder to
    >> get files from all sub folders.....
    >>

    >
    >
    > There's a separate dialog, wx.DirDialog.


    Now I cant find where I've seen how to get directory listing with
    premissions (-rw-...and this).
    SMALLp, Dec 20, 2007
    #3
  4. SMALLp

    farsheed Guest

    import wx
    def dirchoose():
    'Gives the user selected path. Use: dirchoose()'
    global _selectedDir , _userCancel #you should define
    them before
    userPath = 'c:/'
    app = wx.App()
    dialog = wx.DirDialog(None, "Please choose your project directory:",\
    style=1 ,defaultPath=userPath, pos = (10,10))
    if dialog.ShowModal() == wx.ID_OK:
    _selectedDir = dialog.GetPath()
    return _selectedDir
    else:
    #app.Close()
    dialog.Destroy()
    return _userCancel

    Cheers, Farsheed.
    farsheed, Dec 20, 2007
    #4
  5. SMALLp

    SMALLp Guest

    farsheed wrote:
    > import wx
    > def dirchoose():
    > 'Gives the user selected path. Use: dirchoose()'
    > global _selectedDir , _userCancel #you should define
    > them before
    > userPath = 'c:/'
    > app = wx.App()
    > dialog = wx.DirDialog(None, "Please choose your project directory:",\
    > style=1 ,defaultPath=userPath, pos = (10,10))
    > if dialog.ShowModal() == wx.ID_OK:
    > _selectedDir = dialog.GetPath()
    > return _selectedDir
    > else:
    > #app.Close()
    > dialog.Destroy()
    > return _userCancel
    >
    > Cheers, Farsheed.

    Thanks! I've already figured it out from first reply. Now i get selected
    directory and i want to get all directories from thin directory. I found
    os.listdir but it oly gets names of files and i nedd output with
    permisions e.g. -rw-r--r-- 1 pofuk pofuk 105 2007-12-19 21:59 login.py
    SMALLp, Dec 20, 2007
    #5
  6. SMALLp

    Tim Roberts Guest

    SMALLp <-com.hr> wrote:
    >
    >Thanks! I've already figured it out from first reply. Now i get selected
    >directory and i want to get all directories from thin directory. I found
    >os.listdir but it oly gets names of files and i nedd output with
    >permisions e.g. -rw-r--r-- 1 pofuk pofuk 105 2007-12-19 21:59 login.py


    Do you want to KNOW the permissions, or do you really want to get the
    output of "ls -l"?

    What you probably want is os.walk. You can call stat or os.path.isdir to
    get information about the files you discover.
    --
    Tim Roberts,
    Providenza & Boekelheide, Inc.
    Tim Roberts, Dec 23, 2007
    #6
    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. Jay B. Harlow [MVP - Outlook]

    Re: FileDialog window handle

    Jay B. Harlow [MVP - Outlook], Sep 2, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    3,845
    Mick Doherty
    Sep 3, 2003
  2. Dan Ignatov

    Re: FileDialog window handle

    Dan Ignatov, Sep 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,065
    Dan Ignatov
    Sep 4, 2003
  3. Anand Pillai

    wxPython Filedialog question

    Anand Pillai, Jun 27, 2003, in forum: Python
    Replies:
    0
    Views:
    1,050
    Anand Pillai
    Jun 27, 2003
  4. John Field
    Replies:
    3
    Views:
    518
    Franz Steinhaeusler
    Jan 19, 2005
  5. OhKyu Yoon
    Replies:
    1
    Views:
    347
Loading...

Share This Page