From 3369927322ed163a98d955461e60d7e5e7f35f37 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 27 Apr 1999 19:51:55 +0000 Subject: [PATCH] Use the much nicer tkFileDialog for loading color name database files (thanks Fred!) --- Tools/pynche/PyncheWidget.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index c8f14e75559..d8ff8facdb8 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -9,6 +9,8 @@ import os import string from Tkinter import * import tkMessageBox +import tkFileDialog +import ColorDB # Milliseconds between interrupt checks KEEPALIVE_TIMER = 500 @@ -165,12 +167,15 @@ email: bwarsaw@python.org''' % __version__) self.__helpwin.deiconify() def __load(self, event=None): - import FileDialog - import ColorDB while 1: - d = FileDialog.FileDialog(self.__root) - file = d.go(pattern='*.txt', key=self.__dialogstate) - if file is None: + idir, ifile = os.path.split(self.__sb.colordb().filename()) + file = tkFileDialog.askopenfilename( + filetypes=[('Text files', '*.txt'), + ('All files', '*'), + ], + initialdir=idir, + initialfile=ifile) + if not file: # cancel button return try: