Mercurial > cpython-lru_cache-weakref
diff Lib/lib-tk/tkFileDialog.py @ 20914:93253c65d863 legacy-trunk
Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 07 Nov 2001 22:38:08 +0000 |
| parents | 9c37ed8868b9 |
| children | 20014716556b |
line wrap: on
line diff
--- a/Lib/lib-tk/tkFileDialog.py Wed Nov 07 14:54:49 2001 +0000 +++ b/Lib/lib-tk/tkFileDialog.py Wed Nov 07 22:38:08 2001 +0000 @@ -64,6 +64,10 @@ command = "tk_getSaveFile" +class Directory(_Dialog): + "Ask for a directory" + + command = "tk_chooseDirectory" # # convenience stuff @@ -71,19 +75,19 @@ def askopenfilename(**options): "Ask for a filename to open" - return apply(Open, (), options).show() + return Open(**options).show() def asksaveasfilename(**options): "Ask for a filename to save as" - return apply(SaveAs, (), options).show() + return SaveAs(**options).show() # FIXME: are the following two perhaps a bit too convenient? def askopenfile(mode = "r", **options): "Ask for a filename to open, and returned the opened file" - filename = apply(Open, (), options).show() + filename = Open(**options).show() if filename: return open(filename, mode) return None @@ -91,11 +95,14 @@ def asksaveasfile(mode = "w", **options): "Ask for a filename to save as, and returned the opened file" - filename = apply(SaveAs, (), options).show() + filename = SaveAs(**options).show() if filename: return open(filename, mode) return None +def askdirectory (**options): + "Ask for a directory, and return the file name" + return Directory(**options).show() # -------------------------------------------------------------------- # test stuff
