summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/FileDialog.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-05-06 17:28:23 (GMT)
committerFred Drake <fdrake@acm.org>1998-05-06 17:28:23 (GMT)
commit073b8290215f7753668575a8f9cba85a64221842 (patch)
tree7d93739fefbb9aae2fcd5850f9394d190f843e64 /Lib/lib-tk/FileDialog.py
parentbb6193c553fca0532f78af80a8f745c305144b87 (diff)
downloadcpython-073b8290215f7753668575a8f9cba85a64221842.zip
cpython-073b8290215f7753668575a8f9cba85a64221842.tar.gz
cpython-073b8290215f7753668575a8f9cba85a64221842.tar.bz2
When a file name is selected ("OK" button, <Return> in the filename entry),
and the "key" keyword parameter was used to invoke .go(), use the directory of the selected file as the stored directory to return to when the same key is used again. This is useful since the user may well entry at least part of the path in the filename box instead of doing a lot of clicking around in the listboxes.
Diffstat (limited to 'Lib/lib-tk/FileDialog.py')
-rw-r--r--Lib/lib-tk/FileDialog.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py
index d3c96b8..74e9741 100644
--- a/Lib/lib-tk/FileDialog.py
+++ b/Lib/lib-tk/FileDialog.py
@@ -122,7 +122,11 @@ class FileDialog:
self.top.grab_set()
self.how = None
self.master.mainloop() # Exited by self.quit(how)
- if key: dialogstates[key] = self.get_filter()
+ if key:
+ directory, pattern = self.get_filter()
+ if self.how:
+ directory = os.path.dirname(self.how)
+ dialogstates[key] = directory, pattern
self.top.destroy()
return self.how