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

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


Patches item #621891, was opened at 2002-10-11 16:04
Message generated for change (Comment added) made by loewis
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: Martin v. Löwis (loewis)
Date: 2003-06-09 18: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 18: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 13: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