summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-11-07 22:38:08 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-11-07 22:38:08 (GMT)
commit25ee87cc50ab99a1342091b5067c074878c9b212 (patch)
tree8dbf2acab791d51f0b8d4bd3486a91614f3817a3 /Lib/lib-tk
parentc52d713b7a324b9ed29ba75f438bf11b96953e41 (diff)
downloadcpython-25ee87cc50ab99a1342091b5067c074878c9b212.zip
cpython-25ee87cc50ab99a1342091b5067c074878c9b212.tar.gz
cpython-25ee87cc50ab99a1342091b5067c074878c9b212.tar.bz2
Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r--Lib/lib-tk/tkFileDialog.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/lib-tk/tkFileDialog.py b/Lib/lib-tk/tkFileDialog.py
index e07e5d0..eb2a900 100644
--- a/Lib/lib-tk/tkFileDialog.py
+++ b/Lib/lib-tk/tkFileDialog.py
@@ -64,6 +64,10 @@ class SaveAs(_Dialog):
command = "tk_getSaveFile"
+class Directory(_Dialog):
+ "Ask for a directory"
+
+ command = "tk_chooseDirectory"
#
# convenience stuff
@@ -71,19 +75,19 @@ class SaveAs(_Dialog):
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 askopenfile(mode = "r", **options):
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