tkFileDialog.... help
Martin Franklin
martin.franklin at waii.com
Thu Aug 24 05:51:38 EDT 2000
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