From 073b8290215f7753668575a8f9cba85a64221842 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 6 May 1998 17:28:23 +0000 Subject: When a file name is selected ("OK" button, 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. --- Lib/lib-tk/FileDialog.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Lib/lib-tk/FileDialog.py') diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py index d3c96b8a00..74e9741251 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 -- cgit v1.2.1