]> granicus.if.org Git - python/commitdiff
When a file name is selected ("OK" button, <Return> in the filename entry),
authorFred Drake <fdrake@acm.org>
Wed, 6 May 1998 17:28:23 +0000 (17:28 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 6 May 1998 17:28:23 +0000 (17:28 +0000)
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

index d3c96b8a00fd8f5ac1016f9f543e57b0c855c5c7..74e9741251311257c1d6ed9d5edf7637e6e1f6ce 100644 (file)
@@ -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