Mercurial > cpython-lru_cache-weakref
diff Lib/lib-tk/FileDialog.py @ 8227:4a13a4d2588b legacy-trunk
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.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 06 May 1998 17:28:23 +0000 |
| parents | 9c37ed8868b9 |
| children | 5b727ab37092 |
line wrap: on
line diff
--- a/Lib/lib-tk/FileDialog.py Wed May 06 15:33:09 1998 +0000 +++ b/Lib/lib-tk/FileDialog.py Wed May 06 17:28:23 1998 +0000 @@ -122,7 +122,11 @@ 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
