471,357 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

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!

Dec 20 '07 #1
5 7382
On Dec 20, 2007 3:19 PM, SMALLp <po***@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.
Dec 20 '07 #2
Chris Mellon wrote:
On Dec 20, 2007 3:19 PM, SMALLp <po***@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).
Dec 20 '07 #3
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.
Dec 20 '07 #4
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
Dec 20 '07 #5
SMALLp <po***@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, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 23 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Anand Pillai | last post: by
3 posts views Thread by John Field | last post: by
2 posts views Thread by Iain King | last post: by
1 post views Thread by kath | last post: by
8 posts views Thread by Janwillem | last post: by
6 posts views Thread by Iain King | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.