diff Lib/lib-tk/FileDialog.py @ 3068:31c52a0a372c legacy-trunk

Filter button should set selection's directory, too
author Guido van Rossum <guido@python.org>
date Fri, 01 Sep 1995 20:36:47 +0000
parents 9c49ace6b1e7
children d04975db52dc
line wrap: on
line diff
--- a/Lib/lib-tk/FileDialog.py	Fri Sep 01 20:35:37 1995 +0000
+++ b/Lib/lib-tk/FileDialog.py	Fri Sep 01 20:36:47 1995 +0000
@@ -77,9 +77,9 @@
     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 @@
 	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()