diff options
Diffstat (limited to 'Lib/idlelib')
37 files changed, 67 insertions, 65 deletions
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py index 298177f..1ad8d15 100644 --- a/Lib/idlelib/AutoCompleteWindow.py +++ b/Lib/idlelib/AutoCompleteWindow.py @@ -1,7 +1,7 @@ """ An auto-completion window for IDLE, used by the AutoComplete extension """ -from Tkinter import * +from tkinter import * from idlelib.MultiCall import MC_SHIFT from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES diff --git a/Lib/idlelib/CallTipWindow.py b/Lib/idlelib/CallTipWindow.py index 2223885..27ed085 100644 --- a/Lib/idlelib/CallTipWindow.py +++ b/Lib/idlelib/CallTipWindow.py @@ -4,7 +4,7 @@ After ToolTip.py, which uses ideas gleaned from PySol Used by the CallTips IDLE extension. """ -from Tkinter import * +from tkinter import * HIDE_VIRTUAL_EVENT_NAME = "<<calltipwindow-hide>>" HIDE_SEQUENCES = ("<Key-Escape>", "<FocusOut>") diff --git a/Lib/idlelib/CodeContext.py b/Lib/idlelib/CodeContext.py index 3ab6e47..84491d5 100644 --- a/Lib/idlelib/CodeContext.py +++ b/Lib/idlelib/CodeContext.py @@ -9,8 +9,8 @@ variable in the CodeContext section of config-extensions.def. Lines which do not open blocks are not shown in the context hints pane. """ -import Tkinter -from Tkconstants import TOP, LEFT, X, W, SUNKEN +import tkinter +from tkinter.constants import TOP, LEFT, X, W, SUNKEN import re from sys import maxsize as INFINITY from idlelib.configHandler import idleConf @@ -69,7 +69,7 @@ class CodeContext: border = 0 for widget in widgets: border += int(str( widget.cget('border') )) - self.label = Tkinter.Label(self.editwin.top, + self.label = tkinter.Label(self.editwin.top, text="\n" * (self.context_depth - 1), anchor=W, justify=LEFT, font=self.textfont, diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py index e7112c9..ab69b8a 100644 --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -2,7 +2,7 @@ import time import re import keyword import builtins -from Tkinter import * +from tkinter import * from idlelib.Delegator import Delegator from idlelib.configHandler import idleConf diff --git a/Lib/idlelib/Debugger.py b/Lib/idlelib/Debugger.py index 00aa4bb..ed66084 100644 --- a/Lib/idlelib/Debugger.py +++ b/Lib/idlelib/Debugger.py @@ -1,7 +1,7 @@ import os import bdb import types -from Tkinter import * +from tkinter import * from idlelib.WindowList import ListedToplevel from idlelib.ScrolledList import ScrolledList from idlelib import macosxSupport diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index e049b66..a7970ba 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -4,9 +4,9 @@ import re import string import imp from itertools import count -from Tkinter import * -import tkSimpleDialog -import tkMessageBox +from tkinter import * +import tkinter.simpledialog as tkSimpleDialog +import tkinter.messagebox as tkMessageBox import traceback import webbrowser diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py index 53e30b4..4c0076d 100644 --- a/Lib/idlelib/FileList.py +++ b/Lib/idlelib/FileList.py @@ -1,6 +1,6 @@ import os -from Tkinter import * -import tkMessageBox +from tkinter import * +import tkinter.messagebox as tkMessageBox class FileList: diff --git a/Lib/idlelib/GrepDialog.py b/Lib/idlelib/GrepDialog.py index 51affef..01e0483 100644 --- a/Lib/idlelib/GrepDialog.py +++ b/Lib/idlelib/GrepDialog.py @@ -1,7 +1,7 @@ import os import fnmatch import sys -from Tkinter import * +from tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index b4de84e..a6559ab 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -3,11 +3,11 @@ import types import sys import codecs import tempfile -import tkFileDialog -import tkMessageBox +import tkinter.filedialog as tkFileDialog +import tkinter.messagebox as tkMessageBox import re -from Tkinter import * -from SimpleDialog import SimpleDialog +from tkinter import * +from tkinter.simpledialog import SimpleDialog from idlelib.configHandler import idleConf diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py index f2e3887..1c40638 100644 --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -31,7 +31,7 @@ Each function will be called at most once for each event. import sys import re -import Tkinter +import tkinter # the event type constants, which define the meaning of mc_type MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3; @@ -304,7 +304,7 @@ def MultiCallCreator(widget): return _multicall_dict[widget] class MultiCall (widget): - assert issubclass(widget, Tkinter.Misc) + assert issubclass(widget, tkinter.Misc) def __init__(self, *args, **kwargs): widget.__init__(self, *args, **kwargs) @@ -396,8 +396,8 @@ def MultiCallCreator(widget): if __name__ == "__main__": # Test - root = Tkinter.Tk() - text = MultiCallCreator(Tkinter.Text)(root) + root = tkinter.Tk() + text = MultiCallCreator(tkinter.Text)(root) text.pack() def bindseq(seq, n=[0]): def handler(event): diff --git a/Lib/idlelib/MultiStatusBar.py b/Lib/idlelib/MultiStatusBar.py index 8ee2d03..4fc8dcf 100644 --- a/Lib/idlelib/MultiStatusBar.py +++ b/Lib/idlelib/MultiStatusBar.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class MultiStatusBar(Frame): diff --git a/Lib/idlelib/ObjectBrowser.py b/Lib/idlelib/ObjectBrowser.py index 4cb432f..b359efc 100644 --- a/Lib/idlelib/ObjectBrowser.py +++ b/Lib/idlelib/ObjectBrowser.py @@ -123,7 +123,7 @@ def make_objecttreeitem(labeltext, object, setfunction=None): def _test(): import sys - from Tkinter import Tk + from tkinter import Tk root = Tk() root.configure(bd=0, bg="yellow") root.focus_set() diff --git a/Lib/idlelib/OutputWindow.py b/Lib/idlelib/OutputWindow.py index 42aa77e..0782eaf 100644 --- a/Lib/idlelib/OutputWindow.py +++ b/Lib/idlelib/OutputWindow.py @@ -1,7 +1,7 @@ -from Tkinter import * +from tkinter import * from idlelib.EditorWindow import EditorWindow import re -import tkMessageBox +import tkinter.messagebox as tkMessageBox from idlelib import IOBinding class OutputWindow(EditorWindow): diff --git a/Lib/idlelib/Percolator.py b/Lib/idlelib/Percolator.py index 80140d0..c91de38 100644 --- a/Lib/idlelib/Percolator.py +++ b/Lib/idlelib/Percolator.py @@ -52,7 +52,7 @@ class Percolator: filter.setdelegate(None) def main(): - import Tkinter as Tk + import tkinter as Tk class Tracer(Delegator): def __init__(self, name): self.name = name diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 16f9ccf..a7fd928 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -15,12 +15,12 @@ import linecache from code import InteractiveInterpreter try: - from Tkinter import * + from tkinter import * except ImportError: print("** IDLE can't import Tkinter. " \ "Your Python may not be configured for Tk. **", file=sys.__stderr__) sys.exit(1) -import tkMessageBox +import tkinter.messagebox as tkMessageBox from idlelib.EditorWindow import EditorWindow, fixwordbreaks from idlelib.FileList import FileList @@ -983,8 +983,8 @@ class PyShell(OutputWindow): (sys.version, sys.platform, self.COPYRIGHT, self.firewallmessage, idlever.IDLE_VERSION, nosub)) self.showprompt() - import Tkinter - Tkinter._default_root = None # 03Jan04 KBK What's this? + import tkinter + tkinter._default_root = None # 03Jan04 KBK What's this? return True def readline(self): diff --git a/Lib/idlelib/ReplaceDialog.py b/Lib/idlelib/ReplaceDialog.py index 2d6c802..d713e61 100644 --- a/Lib/idlelib/ReplaceDialog.py +++ b/Lib/idlelib/ReplaceDialog.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py index 226c66c..1e98f1e 100644 --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -22,7 +22,7 @@ import re import string import tabnanny import tokenize -import tkMessageBox +import tkinter.messagebox as tkMessageBox from idlelib.EditorWindow import EditorWindow from idlelib import PyShell diff --git a/Lib/idlelib/ScrolledList.py b/Lib/idlelib/ScrolledList.py index 350fdbd..0255a0a 100644 --- a/Lib/idlelib/ScrolledList.py +++ b/Lib/idlelib/ScrolledList.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class ScrolledList: diff --git a/Lib/idlelib/SearchDialog.py b/Lib/idlelib/SearchDialog.py index 7c70b84..76c444c 100644 --- a/Lib/idlelib/SearchDialog.py +++ b/Lib/idlelib/SearchDialog.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase diff --git a/Lib/idlelib/SearchDialogBase.py b/Lib/idlelib/SearchDialogBase.py index f63e7ae..65914ac 100644 --- a/Lib/idlelib/SearchDialogBase.py +++ b/Lib/idlelib/SearchDialogBase.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class SearchDialogBase: diff --git a/Lib/idlelib/SearchEngine.py b/Lib/idlelib/SearchEngine.py index 6745faf..13a6a6b 100644 --- a/Lib/idlelib/SearchEngine.py +++ b/Lib/idlelib/SearchEngine.py @@ -1,6 +1,6 @@ import re -from Tkinter import * -import tkMessageBox +from tkinter import * +import tkinter.messagebox as tkMessageBox def get(root): if not hasattr(root, "_searchengine"): diff --git a/Lib/idlelib/StackViewer.py b/Lib/idlelib/StackViewer.py index 9ca1ff5..4ef2d31 100644 --- a/Lib/idlelib/StackViewer.py +++ b/Lib/idlelib/StackViewer.py @@ -7,7 +7,7 @@ from idlelib.ObjectBrowser import ObjectTreeItem, make_objecttreeitem def StackBrowser(root, flist=None, tb=None, top=None): if top is None: - from Tkinter import Toplevel + from tkinter import Toplevel top = Toplevel(root) sc = ScrolledCanvas(top, bg="white", highlightthickness=0) sc.frame.pack(expand=1, fill="both") diff --git a/Lib/idlelib/ToolTip.py b/Lib/idlelib/ToolTip.py index ce7a3d3..b178803 100644 --- a/Lib/idlelib/ToolTip.py +++ b/Lib/idlelib/ToolTip.py @@ -3,7 +3,7 @@ # may be useful for some purposes in (or almost in ;) the current project scope # Ideas gleaned from PySol -from Tkinter import * +from tkinter import * class ToolTipBase: diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py index 04e16a2..d4e524b 100644 --- a/Lib/idlelib/TreeWidget.py +++ b/Lib/idlelib/TreeWidget.py @@ -15,7 +15,7 @@ # - optimize tree redraw after expand of subnode import os -from Tkinter import * +from tkinter import * import imp from idlelib import ZoomHeight diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py index 57b02df..d2ef638 100644 --- a/Lib/idlelib/UndoDelegator.py +++ b/Lib/idlelib/UndoDelegator.py @@ -1,5 +1,5 @@ import string -from Tkinter import * +from tkinter import * from idlelib.Delegator import Delegator diff --git a/Lib/idlelib/WidgetRedirector.py b/Lib/idlelib/WidgetRedirector.py index 3df5a9a..ba5251f 100644 --- a/Lib/idlelib/WidgetRedirector.py +++ b/Lib/idlelib/WidgetRedirector.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class WidgetRedirector: diff --git a/Lib/idlelib/WindowList.py b/Lib/idlelib/WindowList.py index 28b55b8..761e015 100644 --- a/Lib/idlelib/WindowList.py +++ b/Lib/idlelib/WindowList.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class WindowList: diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py index 43a1313..cfccc0f 100644 --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -2,7 +2,7 @@ """ -from Tkinter import * +from tkinter import * import os from idlelib import textView diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py index b750dcd..db6d541 100644 --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -9,8 +9,10 @@ Note that tab width in IDLE is currently fixed at eight due to Tk issues. Refer to comments in EditorWindow autoindent code for details. """ -from Tkinter import * -import tkMessageBox, tkColorChooser, tkFont +from tkinter import * +import tkinter.messagebox as tkMessageBox +import tkinter.colorchooser as tkColorChooser +import tkinter.font as tkFont import copy from idlelib.configHandler import idleConf diff --git a/Lib/idlelib/configHelpSourceEdit.py b/Lib/idlelib/configHelpSourceEdit.py index 912a441..2ccb400 100644 --- a/Lib/idlelib/configHelpSourceEdit.py +++ b/Lib/idlelib/configHelpSourceEdit.py @@ -3,9 +3,9 @@ import os import sys -from Tkinter import * -import tkMessageBox -import tkFileDialog +from tkinter import * +import tkinter.messagebox as tkMessageBox +import tkinter.filedialog as tkFileDialog class GetHelpSourceDialog(Toplevel): def __init__(self, parent, title, menuItem='', filePath=''): diff --git a/Lib/idlelib/configSectionNameDialog.py b/Lib/idlelib/configSectionNameDialog.py index 21dfab1..4378d6f 100644 --- a/Lib/idlelib/configSectionNameDialog.py +++ b/Lib/idlelib/configSectionNameDialog.py @@ -2,8 +2,8 @@ Dialog that allows user to specify a new config file section name. Used to get new highlight theme and keybinding set names. """ -from Tkinter import * -import tkMessageBox +from tkinter import * +import tkinter.messagebox as tkMessageBox class GetCfgSectionNameDialog(Toplevel): def __init__(self,parent,title,message,usedNames): diff --git a/Lib/idlelib/dynOptionMenuWidget.py b/Lib/idlelib/dynOptionMenuWidget.py index 78406d7..922de96 100644 --- a/Lib/idlelib/dynOptionMenuWidget.py +++ b/Lib/idlelib/dynOptionMenuWidget.py @@ -2,8 +2,8 @@ OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness """ -from Tkinter import OptionMenu -from Tkinter import _setit +from tkinter import OptionMenu +from tkinter import _setit import copy class DynOptionMenu(OptionMenu): diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py index f326b6f..f5d32ef 100644 --- a/Lib/idlelib/keybindingDialog.py +++ b/Lib/idlelib/keybindingDialog.py @@ -1,8 +1,8 @@ """ Dialog for building Tkinter accelerator key bindings """ -from Tkinter import * -import tkMessageBox +from tkinter import * +import tkinter.messagebox as tkMessageBox import string class GetKeysDialog(Toplevel): diff --git a/Lib/idlelib/macosxSupport.py b/Lib/idlelib/macosxSupport.py index 20c8e23..5e249e2 100644 --- a/Lib/idlelib/macosxSupport.py +++ b/Lib/idlelib/macosxSupport.py @@ -3,7 +3,7 @@ A number of function that enhance IDLE on MacOSX when it used as a normal GUI application (as opposed to an X11 application). """ import sys -import Tkinter +import tkinter def runningAsOSXApp(): """ Returns True iff running from the IDLE.app bundle on OSX """ @@ -26,7 +26,7 @@ def addOpenEventSupport(root, flist): def hideTkConsole(root): try: root.tk.call('console', 'hide') - except Tkinter.TclError: + except tkinter.TclError: # Some versions of the Tk framework don't have a console object pass @@ -46,7 +46,7 @@ def overrideRootMenu(root, flist): # # Due to a (mis-)feature of TkAqua the user will also see an empty Help # menu. - from Tkinter import Menu, Text, Text + from tkinter import Menu, Text, Text from idlelib.EditorWindow import prepstr, get_accelerator from idlelib import Bindings from idlelib import WindowList diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index b731310..355f853 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -127,9 +127,9 @@ def manage_socket(address): server.handle_request() # A single request only def show_socket_error(err, address): - import Tkinter - import tkMessageBox - root = Tkinter.Tk() + import tkinter + import tkinter.messagebox as tkMessageBox + root = tkinter.Tk() root.withdraw() if err.args[0] == 61: # connection refused msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\ diff --git a/Lib/idlelib/tabbedpages.py b/Lib/idlelib/tabbedpages.py index f8d89a4..f791702 100644 --- a/Lib/idlelib/tabbedpages.py +++ b/Lib/idlelib/tabbedpages.py @@ -7,7 +7,7 @@ TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. TabSet -- A widget containing tabs (buttons) in one or more rows. """ -from Tkinter import * +from tkinter import * class InvalidNameError(Exception): pass class AlreadyExistsError(Exception): pass diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py index 0e7e663..3f3c247 100644 --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -2,8 +2,8 @@ """ -from Tkinter import * -import tkMessageBox +from tkinter import * +import tkinter.messagebox as tkMessageBox class TextViewer(Toplevel): """A simple text viewer dialog for IDLE @@ -68,7 +68,7 @@ def view_file(parent, title, filename, encoding=None): else: textFile = open(filename, 'r') except IOError: - import tkMessageBox + import tkinter.messagebox as tkMessageBox tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) |