diff options
author | Georg Brandl <georg@python.org> | 2010-08-02 22:08:58 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-08-02 22:08:58 (GMT) |
commit | bf76ce168cc82aae2158dac7f1c0360eb757936f (patch) | |
tree | ecdb31cb4d04921486b97583d0417a0b6bd4b957 /Tools/pynche/PyncheWidget.py | |
parent | 18009342850e71775e7ebac7b6a743fbe3265c78 (diff) | |
download | cpython-bf76ce168cc82aae2158dac7f1c0360eb757936f.zip cpython-bf76ce168cc82aae2158dac7f1c0360eb757936f.tar.gz cpython-bf76ce168cc82aae2158dac7f1c0360eb757936f.tar.bz2 |
Make the Pynche tool work with Python 3.
Diffstat (limited to 'Tools/pynche/PyncheWidget.py')
-rw-r--r-- | Tools/pynche/PyncheWidget.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index fcfe7ce..364f22b 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -6,9 +6,8 @@ It is used to bring up other windows. import sys import os -from Tkinter import * -import tkMessageBox -import tkFileDialog +from tkinter import * +from tkinter import messagebox, filedialog import ColorDB # Milliseconds between interrupt checks @@ -150,7 +149,7 @@ class PyncheWidget: def __popup_about(self, event=None): from Main import __version__ - tkMessageBox.showinfo('About Pynche ' + __version__, + messagebox.showinfo('About Pynche ' + __version__, '''\ Pynche %s The PYthonically Natural @@ -168,7 +167,7 @@ email: bwarsaw@python.org''' % __version__) def __load(self, event=None): while 1: idir, ifile = os.path.split(self.__sb.colordb().filename()) - file = tkFileDialog.askopenfilename( + file = filedialog.askopenfilename( filetypes=[('Text files', '*.txt'), ('All files', '*'), ], @@ -180,12 +179,12 @@ email: bwarsaw@python.org''' % __version__) try: colordb = ColorDB.get_colordb(file) except IOError: - tkMessageBox.showerror('Read error', '''\ + messagebox.showerror('Read error', '''\ Could not open file for reading: %s''' % file) continue if colordb is None: - tkMessageBox.showerror('Unrecognized color file type', '''\ + messagebox.showerror('Unrecognized color file type', '''\ Unrecognized color file type in file: %s''' % file) continue @@ -249,6 +248,8 @@ class Helpwin: +import functools +@functools.total_ordering class PopupViewer: def __init__(self, module, name, switchboard, root): self.__m = module @@ -279,8 +280,11 @@ class PopupViewer: self.__sb.add_view(self.__window) self.__window.deiconify() - def __cmp__(self, other): - return cmp(self.__menutext, other.__menutext) + def __eq__(self, other): + return self.__menutext == other.__menutext + + def __lt__(self, other): + return self.__menutext < other.__menutext def make_view_popups(switchboard, root, extrapath): |