Use the much nicer tkFileDialog for loading color name database files

(thanks Fred!)
This commit is contained in:
Barry Warsaw 1999-04-27 19:51:55 +00:00
parent a853adc110
commit 3369927322
1 changed files with 10 additions and 5 deletions

View File

@ -9,6 +9,8 @@ import os
import string import string
from Tkinter import * from Tkinter import *
import tkMessageBox import tkMessageBox
import tkFileDialog
import ColorDB
# Milliseconds between interrupt checks # Milliseconds between interrupt checks
KEEPALIVE_TIMER = 500 KEEPALIVE_TIMER = 500
@ -165,12 +167,15 @@ email: bwarsaw@python.org''' % __version__)
self.__helpwin.deiconify() self.__helpwin.deiconify()
def __load(self, event=None): def __load(self, event=None):
import FileDialog
import ColorDB
while 1: while 1:
d = FileDialog.FileDialog(self.__root) idir, ifile = os.path.split(self.__sb.colordb().filename())
file = d.go(pattern='*.txt', key=self.__dialogstate) file = tkFileDialog.askopenfilename(
if file is None: filetypes=[('Text files', '*.txt'),
('All files', '*'),
],
initialdir=idir,
initialfile=ifile)
if not file:
# cancel button # cancel button
return return
try: try: