diff options
author | Guido van Rossum <guido@python.org> | 1995-09-01 20:36:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-01 20:36:47 (GMT) |
commit | b9e39c8861b010f5cedbec9c37f4106de66bcb72 (patch) | |
tree | 50b1180152346197ef7f1861d81ff7945fa6c3dd /Lib | |
parent | bf4d8f9d876d422ebf760998544e0eb8b72aa524 (diff) | |
download | cpython-b9e39c8861b010f5cedbec9c37f4106de66bcb72.zip cpython-b9e39c8861b010f5cedbec9c37f4106de66bcb72.tar.gz cpython-b9e39c8861b010f5cedbec9c37f4106de66bcb72.tar.bz2 |
Filter button should set selection's directory, too
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib-tk/FileDialog.py | 5 | ||||
-rwxr-xr-x | Lib/tkinter/FileDialog.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py index fb2ccd7..a2e56ea 100644 --- a/Lib/lib-tk/FileDialog.py +++ b/Lib/lib-tk/FileDialog.py @@ -77,9 +77,9 @@ class FileDialog: def go(self, directory=os.curdir, pattern="*", default=""): self.directory = directory self.set_filter(directory, pattern) + self.filter_command() self.set_selection(default) self.selection.focus_set() - self.filter_command() self.top.grab_set() try: self.master.mainloop() @@ -136,6 +136,9 @@ class FileDialog: self.files.delete(0, END) for name in matchingfiles: self.files.insert(END, name) + head, tail = os.path.split(self.selection.get()) + if tail == os.curdir: tail = '' + self.set_selection(tail) def get_filter(self): filter = self.filter.get() diff --git a/Lib/tkinter/FileDialog.py b/Lib/tkinter/FileDialog.py index fb2ccd7..a2e56ea 100755 --- a/Lib/tkinter/FileDialog.py +++ b/Lib/tkinter/FileDialog.py @@ -77,9 +77,9 @@ class FileDialog: def go(self, directory=os.curdir, pattern="*", default=""): self.directory = directory self.set_filter(directory, pattern) + self.filter_command() self.set_selection(default) self.selection.focus_set() - self.filter_command() self.top.grab_set() try: self.master.mainloop() @@ -136,6 +136,9 @@ class FileDialog: self.files.delete(0, END) for name in matchingfiles: self.files.insert(END, name) + head, tail = os.path.split(self.selection.get()) + if tail == os.curdir: tail = '' + self.set_selection(tail) def get_filter(self): filter = self.filter.get() |