wxPython FileDialog, select folder

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SMALLp

    #1

    wxPython FileDialog, select folder

    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!

  • Chris Mellon

    #2
    Re: wxPython FileDialog, select folder

    On Dec 20, 2007 3:19 PM, SMALLp <pofuk@email. t-com.hrwrote:
    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.

    Comment

    • SMALLp

      #3
      Re: wxPython FileDialog, select folder

      Chris Mellon wrote:
      On Dec 20, 2007 3:19 PM, SMALLp <pofuk@email. t-com.hrwrote:
      >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).

      Comment

      • farsheed

        #4
        Re: wxPython FileDialog, select folder

        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(No ne, "Please choose your project directory:",\
        style=1 ,defaultPath=us erPath, pos = (10,10))
        if dialog.ShowModa l() == wx.ID_OK:
        _selectedDir = dialog.GetPath( )
        return _selectedDir
        else:
        #app.Close()
        dialog.Destroy( )
        return _userCancel

        Cheers, Farsheed.

        Comment

        • SMALLp

          #5
          Re: wxPython FileDialog, select folder

          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(No ne, "Please choose your project directory:",\
          style=1 ,defaultPath=us erPath, pos = (10,10))
          if dialog.ShowModa l() == 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

          Comment

          • Tim Roberts

            #6
            Re: wxPython FileDialog, select folder

            SMALLp <pofuk@email. t-com.hrwrote:
            >
            >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, timr@probo.com
            Providenza & Boekelheide, Inc.

            Comment

            Working...