This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkFileDialog multiple option
Type: Stage:
Components: Tkinter Versions: Python 2.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, mfranklin1, s014djs
Priority: normal Keywords: patch

Created on 2002-10-11 14:04 by mfranklin1, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkFileDialog.diff mfranklin1, 2002-10-11 14:04 diff
Messages (6)
msg41363 - (view) Author: Martin Franklin (mfranklin1) Date: 2002-10-11 14:04
In tk8.4  tk_getOpenFile and tk_getSaveFile dialogs used 
by tkFileDialog.py  now allow the multiple option on all 
platforms, according to the docs... I have only tested in 
Linux (RedHat 7.2) python 2.2.1 and tk 8.4  

This patch adds two new functions to the tkFileDialog 
module askopenfilenames() and askopenfiles()

the function doc strings explain what they do...

I've uploaded a diff.
msg41364 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-14 11:56
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as tkFileDialog.py 1.8.
msg41365 - (view) Author: Deacon Sweeney (s014djs) Date: 2003-06-09 16:33
Logged In: YES 
user_id=797021

This didn't really work for me. The problem is in 
tkCommonDialog.py, in the Dialog.show(). The first try is not 
set up to handle the list that gets returned by the multiple 
option.

Here's a fix: replace the stuff in that try (a call command, 
followed by a _fixresult command, with the following:

[start snip]

            t = w.tk.call(self.command, *w._options
(self.options))

            # for the special case of multiple file selection,
            # return a list, instead of a singleton
            for i, j in self.options.items():
                if i == 'multiple' and self.command 
== 'tk_getOpenFile':
                    s = []
                    for m in t:
                        s.append(self._fixresult(w, m))
                    break
                else:
                    s = self._fixresult(w, t)

[end snip]

Its only set up to handle stuff from tk_getOpenFile 
commands, but would provide a framework for solving other 
problems as well.
msg41366 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-06-09 16:51
Logged In: YES 
user_id=21627

Are you trying to report some bug? If so, what bug? I.e.
what is your source code, what is the expected behaviour,
what is the observed behaviour?
msg41367 - (view) Author: Deacon Sweeney (s014djs) Date: 2003-06-09 18:37
Logged In: YES 
user_id=797021

I encountered this bug running Python2.3 beta, on Windows
XP. The reported patch (621891 tkFileDialog multiple option)
is supposed to return a list of file names upon selection of
multiple files in the askopenfilenames function of the
tkFileDialog module. It fails, mentioning some bug about
concatenating a string with a tuple, if I remember
correctly.

So I fixed it on my machine. I haven't studied the whole
system to know what other fuctions call the show function,
but I specified the fix for the tk_getOpenFile command with
the 'multiple' option, so it shouldn't fail for any other
cases. 

I need this option for the software I'm developing, but am
new to this development forum. Is there anything else I can
do to help get this fixed for the Python 2.3 release?
msg41368 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-06-14 21:35
Logged In: YES 
user_id=21627

This is now fixed in

tkFileDialog.py 1.10
_tkinter.c 1.161
History
Date User Action Args
2022-04-10 16:05:45adminsetgithub: 37311
2002-10-11 14:04:59mfranklin1create