View Full Version : Folder children
January 3rd, 2007, 02:00 AM
, i was wondering , how do i use a gtk dialog via pyGTK to let me select a folder and it return all the files in that folder?
ive got some code that works to select multiple files but i cant seem to do the above.
just ask for any more details
January 3rd, 2007, 04:57 AM
If you setup your FileChooserDialog to select a folder, you can use glob.glob to list the the contents of the directory returned by get_filename().
January 3rd, 2007, 10:52 AM
thx, but thats what i dont know how to do, set my filechooserdialog to select a folder.
January 3rd, 2007, 02:38 PM
you need to set the action to gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER
January 4th, 2007, 12:38 AM
thanks duff :) worked like a charm,
is there a way to check whether the item returned by glob in a folder is another folder or or a file?
last question, i promise :)
January 4th, 2007, 03:07 AM
You could get that information from os.stat, but if you're needing to dive into nested directories, try os.walk instead of glob.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.