[Patches] [ python-Patches-621891 ] tkFileDialog multiple option

SourceForge.net noreply@sourceforge.net
Mon, 09 Jun 2003 11:37:51 -0700


Patches item #621891, was opened at 2002-10-11 10:04
Message generated for change (Comment added) made by s014djs
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=621891&group_id=5470

Category: Tkinter
Group: Python 2.2.x
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Martin Franklin (mfranklin1)
Assigned to: Nobody/Anonymous (nobody)
Summary: tkFileDialog multiple option

Initial Comment:
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.

----------------------------------------------------------------------

Comment By: Deacon Sweeney (s014djs)
Date: 2003-06-09 14:37

Message:
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?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-06-09 12:51

Message:
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?

----------------------------------------------------------------------

Comment By: Deacon Sweeney (s014djs)
Date: 2003-06-09 12:33

Message:
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.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-10-14 07:56

Message:
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as tkFileDialog.py 1.8.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=621891&group_id=5470