Mercurial > cpython-lru_cache-weakref
diff Lib/lib-tk/tkFileDialog.py @ 20917:20014716556b legacy-trunk
Merge directory chooser into tkFileDialog.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 08 Nov 2001 17:51:33 +0000 |
| parents | 93253c65d863 |
| children | 5ff8bb25031c |
line wrap: on
line diff
--- a/Lib/lib-tk/tkFileDialog.py Thu Nov 08 17:19:29 2001 +0000 +++ b/Lib/lib-tk/tkFileDialog.py Thu Nov 08 17:51:33 2001 +0000 @@ -5,7 +5,8 @@ # tk common file dialogues # # this module provides interfaces to the native file dialogues -# available in Tk 4.2 and newer. +# available in Tk 4.2 and newer, and the directory dialogue available +# in Tk 8.3 and newer. # # written by Fredrik Lundh, May 1997. # @@ -28,6 +29,12 @@ # # - title: dialog title # +# options for the directory chooser: +# +# - initialdir, parent, title: see above +# +# - mustexist: if true, user must pick an existing directory +# from tkCommonDialog import Dialog @@ -64,11 +71,20 @@ command = "tk_getSaveFile" -class Directory(_Dialog): + +# the directory dialog has its own _fix routines. +class Directory(Dialog): "Ask for a directory" command = "tk_chooseDirectory" + def _fixresult(self, widget, result): + if result: + # keep directory until next time + self.options["initialdir"] = result + self.directory = result # compatibility + return result + # # convenience stuff
