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.
This commit is contained in:
Fred Drake 1998-05-06 17:28:23 +00:00
parent bb6193c553
commit 073b829021
1 changed files with 5 additions and 1 deletions

View 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