tkFileDialog.... help

Kevin Cazabon kcazabon at home.com
Thu Aug 24 22:31:01 EDT 2000


Thanks Martin;

It works ok, but the problem I have is that you can't specify multiple file
types to filter.  I guess it's better than only being able to select
individual files, but it's not ideally what I was looking for.

In the meantime though, it's working.  I'm going to try to see if maybe
Mark's win32 stuff can be hacked to do it through the windows API.

Kevin.



"Martin Franklin" <martin.franklin at waii.com> wrote in message
news:39A4F02A.778EA4B8 at bedford.waii.com...
|
| Kevin,
|
| Check out this MultiFileDialog....I can't remember where I got it
| though.....
|
|
| from FileDialog import *
| import string
|
| class LoadFiles(FileDialog):
|     """File selection dialog which checks that the file exists."""
|     title = "Multi-File Selection"
|
|     def __init__(self, master, title=None):
|         FileDialog.__init__(self, master, title)
|
|         self.files.config(selectmode='extended', exportselection=1)
|         self.files.unbind('<ButtonRelease-1>')
|         self.files.unbind('<Double-ButtonRelease-1>')
|
|         self.label1.forget()
|         self.selection.forget()
|
|     def ok_command( self):
|         files=[]
|
|         append = files.append
|         join = os.path.join
|         get = self.files.get
|
|         head = self.get_filter()[0]
|
|         for item in self.files.curselection():
|             append( join( head, get( int(item))))
|
|         if len( files) == 0:
|             self.master.bell()
|         else:
|             self.quit( files)
|
| if __name__ == "__main__":
|     app = Tk()
|     app.withdraw()
|
|     fd = LoadFiles(app)
|
|     filelist = fd.go('.','*.py')
|
|     for filename in filelist:
|         print filename
|
|
| Kevin Cazabon wrote:
| >
| > I'm trying to use Fred's handy tkFileDialog.askloadfilename(), and was
| > wondering:
| >
| > -is there any way to allow it to return multiple file names at the same
time
| > (i.e. allow the user to select multiple files) when opening/loading?
| >
| > If not, anyone have a handy hack for it?  q:]
| >
| > Thanks for any input...
| >
| > Kevin.
| >
| > --
| > http://www.python.org/mailman/listinfo/python-list
|





More information about the Python-list mailing list