diff options
author | Georg Brandl <georg@python.org> | 2008-05-16 15:48:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-05-16 15:48:15 (GMT) |
commit | ad9afeb8f02db9a13d2ed8e45361ecbc0d19bd32 (patch) | |
tree | 40cd28e4b9d339d38ac00792f37948fdef291cbf | |
parent | bbc57d73a0f0d1476d9c23b920ecc1ef8212a554 (diff) | |
download | cpython-ad9afeb8f02db9a13d2ed8e45361ecbc0d19bd32.zip cpython-ad9afeb8f02db9a13d2ed8e45361ecbc0d19bd32.tar.gz cpython-ad9afeb8f02db9a13d2ed8e45361ecbc0d19bd32.tar.bz2 |
Tkinter rename, step 2: fix imports and add stub modules.
53 files changed, 206 insertions, 85 deletions
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py index 635775d..ab132c1 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 MultiCall import MC_SHIFT import AutoComplete 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 420ec33..941bb26 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 from configHandler import idleConf import re from sys import maxint as INFINITY @@ -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 e55f9e6..fb84805 100644 --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -2,7 +2,7 @@ import time import re import keyword import __builtin__ -from Tkinter import * +from tkinter import * from Delegator import Delegator from configHandler import idleConf diff --git a/Lib/idlelib/Debugger.py b/Lib/idlelib/Debugger.py index a56c224..fa2a56b 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 WindowList import ListedToplevel from ScrolledList import ScrolledList import macosxSupport diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 8d35198c..2f728b3 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -3,9 +3,9 @@ import os import re 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 from MultiCall import MultiCallCreator import webbrowser @@ -45,7 +45,7 @@ class EditorWindow(object): from UndoDelegator import UndoDelegator from IOBinding import IOBinding, filesystemencoding, encoding import Bindings - from Tkinter import Toplevel + from tkinter import Toplevel from MultiStatusBar import MultiStatusBar help_url = None diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py index e40c7a7..4520334 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 ab136bc..ccee522 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 * import SearchEngine from SearchDialogBase import SearchDialogBase diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 01d278e..e18ff3f 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -10,11 +10,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 configHandler import idleConf diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py index 51de639..269ab3f 100644 --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -32,7 +32,7 @@ Each function will be called at most once for each event. import sys import string 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; @@ -292,7 +292,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): apply(widget.__init__, (self,)+args, kwargs) @@ -382,8 +382,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 2d4c547..dadc42d 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 8ff0041..c328cdc 100644 --- a/Lib/idlelib/ObjectBrowser.py +++ b/Lib/idlelib/ObjectBrowser.py @@ -136,7 +136,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 787e9b0..afc4e39 100644 --- a/Lib/idlelib/OutputWindow.py +++ b/Lib/idlelib/OutputWindow.py @@ -1,7 +1,7 @@ -from Tkinter import * +from tkinter import * from EditorWindow import EditorWindow import re -import tkMessageBox +import tkinter.messagebox as tkMessageBox import IOBinding class OutputWindow(EditorWindow): diff --git a/Lib/idlelib/Percolator.py b/Lib/idlelib/Percolator.py index ebbcba9..21d8a47 100644 --- a/Lib/idlelib/Percolator.py +++ b/Lib/idlelib/Percolator.py @@ -81,5 +81,5 @@ def main(): root.mainloop() if __name__ == "__main__": - from Tkinter import * + from tkinter import * main() diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index a17f81f..4754866 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -17,12 +17,12 @@ import linecache from code import InteractiveInterpreter try: - from Tkinter import * + from tkinter import * except ImportError: - print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ + print>>sys.__stderr__, "** IDLE can't import tkinter. " \ "Your Python may not be configured for Tk. **" sys.exit(1) -import tkMessageBox +import tkinter.messagebox as tkMessageBox from EditorWindow import EditorWindow, fixwordbreaks from FileList import FileList @@ -992,8 +992,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 c8eb1c8..c8f6784 100644 --- a/Lib/idlelib/ReplaceDialog.py +++ b/Lib/idlelib/ReplaceDialog.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import SearchEngine from SearchDialogBase import SearchDialogBase diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py index cb01110..c6892f3 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 import PyShell from configHandler import idleConf diff --git a/Lib/idlelib/ScrolledList.py b/Lib/idlelib/ScrolledList.py index 92119365..f923488 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 d7124d6..6c90d28 100644 --- a/Lib/idlelib/SearchDialog.py +++ b/Lib/idlelib/SearchDialog.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import SearchEngine from 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 cc40a00..2d05af8 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 6b7730b..794726d 100644 --- a/Lib/idlelib/StackViewer.py +++ b/Lib/idlelib/StackViewer.py @@ -7,7 +7,7 @@ from 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") @@ -128,7 +128,7 @@ def _test(): reload(testcode) except: sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info() - from Tkinter import Tk + from tkinter import Tk root = Tk() StackBrowser(None, top=root) root.mainloop() 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 5299e0e..876cb0d 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 import ZoomHeight diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py index 5896bd5..544be10 100644 --- a/Lib/idlelib/UndoDelegator.py +++ b/Lib/idlelib/UndoDelegator.py @@ -1,5 +1,5 @@ import string -from Tkinter import * +from tkinter import * from Delegator import Delegator #$ event <<redo>> diff --git a/Lib/idlelib/WidgetRedirector.py b/Lib/idlelib/WidgetRedirector.py index 7c341f2..a87e650 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 658502b..ccf35a8 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 008602c..4900c09 100644 --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -2,7 +2,7 @@ """ -from Tkinter import * +from tkinter import * import os import os.path import textView diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py index acab053..68cc3fe 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 string from configHandler import idleConf diff --git a/Lib/idlelib/configHelpSourceEdit.py b/Lib/idlelib/configHelpSourceEdit.py index 6611621..b80c548 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 4f1b002..bcf132c 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 e81f7ba..90fc323 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 1ce7ff4..e58ac73 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 222abfc..c76381d 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 EditorWindow import prepstr, get_accelerator import Bindings import WindowList diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 8abbe50..18ddca7 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[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 8d7113d..429af5d 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) diff --git a/Lib/lib-tk/Canvas.py b/Lib/lib-tk/Canvas.py index 34464ab..d35b1f5 100644 --- a/Lib/lib-tk/Canvas.py +++ b/Lib/lib-tk/Canvas.py @@ -7,7 +7,7 @@ from warnings import warnpy3k warnpy3k("the Canvas module has been removed in Python 3.0", stacklevel=2) del warnpy3k -from Tkinter import Canvas, _cnfmerge, _flatten +from tkinter import Canvas, _cnfmerge, _flatten class CanvasItem: diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py new file mode 100644 index 0000000..390f836 --- /dev/null +++ b/Lib/lib-tk/FileDialog.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the FileDialog module has been renamed " + "to 'tkinter.filedialog' in Python 3.0", stacklevel=2) + +import tkinter.filedialog +sys.modules[__name__] = tkinter.filedialog diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py new file mode 100644 index 0000000..d19605a --- /dev/null +++ b/Lib/lib-tk/FixTk.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the FixTk module has been renamed " + "to 'tkinter._fix' in Python 3.0", stacklevel=2) + +import tkinter._fix +sys.modules[__name__] = tkinter._fix diff --git a/Lib/lib-tk/ScrolledText.py b/Lib/lib-tk/ScrolledText.py new file mode 100644 index 0000000..1566d89 --- /dev/null +++ b/Lib/lib-tk/ScrolledText.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the ScrolledText module has been renamed " + "to 'tkinter.scrolledtext' in Python 3.0", stacklevel=2) + +import tkinter.scrolledtext +sys.modules[__name__] = tkinter.scrolledtext diff --git a/Lib/lib-tk/SimpleDialog.py b/Lib/lib-tk/SimpleDialog.py new file mode 100644 index 0000000..707f2f5 --- /dev/null +++ b/Lib/lib-tk/SimpleDialog.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the SimpleDialog module has been renamed " + "to 'tkinter.simpledialog' in Python 3.0", stacklevel=2) + +import tkinter.simpledialog +sys.modules[__name__] = tkinter.simpledialog diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py new file mode 100644 index 0000000..77d3df0 --- /dev/null +++ b/Lib/lib-tk/Tix.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the Tix module has been renamed " + "to 'tkinter.tix' in Python 3.0", stacklevel=2) + +import tkinter.tix +sys.modules[__name__] = tkinter.tix diff --git a/Lib/lib-tk/Tkconstants.py b/Lib/lib-tk/Tkconstants.py new file mode 100644 index 0000000..1cf2c8f --- /dev/null +++ b/Lib/lib-tk/Tkconstants.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the Tkconstants module has been renamed " + "to 'tkinter.constants' in Python 3.0", stacklevel=2) + +import tkinter.constants +sys.modules[__name__] = tkinter.constants diff --git a/Lib/lib-tk/Tkdnd.py b/Lib/lib-tk/Tkdnd.py new file mode 100644 index 0000000..dfc0f74 --- /dev/null +++ b/Lib/lib-tk/Tkdnd.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the Tkdnd module has been renamed " + "to 'tkinter.dnd' in Python 3.0", stacklevel=2) + +import tkinter.dnd +sys.modules[__name__] = tkinter.dnd diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py new file mode 100644 index 0000000..4e56a37 --- /dev/null +++ b/Lib/lib-tk/Tkinter.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the Tkinter module has been renamed " + "to 'tkinter' in Python 3.0", stacklevel=2) + +import tkinter +sys.modules[__name__] = tkinter diff --git a/Lib/lib-tk/tkColorChooser.py b/Lib/lib-tk/tkColorChooser.py new file mode 100644 index 0000000..284bc27 --- /dev/null +++ b/Lib/lib-tk/tkColorChooser.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the tkColorChooser module has been renamed " + "to 'tkinter.colorchooser' in Python 3.0", stacklevel=2) + +import tkinter.colorchooser +sys.modules[__name__] = tkinter.colorchooser diff --git a/Lib/lib-tk/tkCommonDialog.py b/Lib/lib-tk/tkCommonDialog.py new file mode 100644 index 0000000..80fcd45 --- /dev/null +++ b/Lib/lib-tk/tkCommonDialog.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the tkCommonDialog module has been renamed " + "to 'tkinter.commondialog' in Python 3.0", stacklevel=2) + +import tkinter.commondialog +sys.modules[__name__] = tkinter.commondialog diff --git a/Lib/lib-tk/tkFont.py b/Lib/lib-tk/tkFont.py new file mode 100644 index 0000000..0e12bc0 --- /dev/null +++ b/Lib/lib-tk/tkFont.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the tkFont module has been renamed " + "to 'tkinter.font' in Python 3.0", stacklevel=2) + +import tkinter.font +sys.modules[__name__] = tkinter.font diff --git a/Lib/lib-tk/tkMessageBox.py b/Lib/lib-tk/tkMessageBox.py new file mode 100644 index 0000000..cea676d --- /dev/null +++ b/Lib/lib-tk/tkMessageBox.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the tkMessageBox module has been renamed " + "to 'tkinter.messagebox' in Python 3.0", stacklevel=2) + +import tkinter.messagebox +sys.modules[__name__] = tkinter.messagebox diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py new file mode 100644 index 0000000..88b8c61 --- /dev/null +++ b/Lib/lib-tk/turtle.py @@ -0,0 +1,8 @@ +import sys +from warnings import warnpy3k + +warnpy3k("the turtle module has been renamed " + "to 'tkinter.turtle' in Python 3.0", stacklevel=2) + +import tkinter.turtle +sys.modules[__name__] = tkinter.turtle diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 987d213..bdfc942 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2017,20 +2017,20 @@ def gui(): self.server = None self.scanner = None - import Tkinter - self.server_frm = Tkinter.Frame(window) - self.title_lbl = Tkinter.Label(self.server_frm, + import tkinter + self.server_frm = tkinter.Frame(window) + self.title_lbl = tkinter.Label(self.server_frm, text='Starting server...\n ') - self.open_btn = Tkinter.Button(self.server_frm, + self.open_btn = tkinter.Button(self.server_frm, text='open browser', command=self.open, state='disabled') - self.quit_btn = Tkinter.Button(self.server_frm, + self.quit_btn = tkinter.Button(self.server_frm, text='quit serving', command=self.quit, state='disabled') - self.search_frm = Tkinter.Frame(window) - self.search_lbl = Tkinter.Label(self.search_frm, text='Search for') - self.search_ent = Tkinter.Entry(self.search_frm) + self.search_frm = tkinter.Frame(window) + self.search_lbl = tkinter.Label(self.search_frm, text='Search for') + self.search_ent = tkinter.Entry(self.search_frm) self.search_ent.bind('<Return>', self.search) - self.stop_btn = Tkinter.Button(self.search_frm, + self.stop_btn = tkinter.Button(self.search_frm, text='stop', pady=0, command=self.stop, state='disabled') if sys.platform == 'win32': # Trying to hide and show this button crashes under Windows. @@ -2049,17 +2049,17 @@ def gui(): self.search_ent.focus_set() font = ('helvetica', sys.platform == 'win32' and 8 or 10) - self.result_lst = Tkinter.Listbox(window, font=font, height=6) + self.result_lst = tkinter.Listbox(window, font=font, height=6) self.result_lst.bind('<Button-1>', self.select) self.result_lst.bind('<Double-Button-1>', self.goto) - self.result_scr = Tkinter.Scrollbar(window, + self.result_scr = tkinter.Scrollbar(window, orient='vertical', command=self.result_lst.yview) self.result_lst.config(yscrollcommand=self.result_scr.set) - self.result_frm = Tkinter.Frame(window) - self.goto_btn = Tkinter.Button(self.result_frm, + self.result_frm = tkinter.Frame(window) + self.goto_btn = tkinter.Button(self.result_frm, text='go to selected', command=self.goto) - self.hide_btn = Tkinter.Button(self.result_frm, + self.hide_btn = tkinter.Button(self.result_frm, text='hide results', command=self.hide) self.goto_btn.pack(side='left', fill='x', expand=1) self.hide_btn.pack(side='right', fill='x', expand=1) @@ -2179,9 +2179,9 @@ def gui(): self.stop() self.collapse() - import Tkinter + import tkinter try: - root = Tkinter.Tk() + root = tkinter.Tk() # Tk will crash if pythonw.exe has an XP .manifest # file and the root has is not destroyed explicitly. # If the problem is ever fixed in Tk, the explicit diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 857810a..c6160da 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -212,6 +212,21 @@ class TestStdlibRenames(unittest.TestCase): 'SocketServer': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', + 'FileDialog': 'tkinter.filedialog', + 'FixTk': 'tkinter._fix', + 'ScrolledText': 'tkinter.scrolledtext', + 'SimpleDialog': 'tkinter.simpledialog', + 'Tix': 'tkinter.tix', + 'tkColorChooser': 'tkinter.colorchooser', + 'tkCommonDialog': 'tkinter.commondialog', + 'Tkconstants': 'tkinter.constants', + 'Tkdnd': 'tkinter.dnd', + 'tkFileDialog': 'tkinter.filedialog', + 'tkFont': 'tkinter.font', + 'Tkinter': 'tkinter', + 'tkMessageBox': 'tkinter.messagebox', + 'tkSimpleDialog': 'tkinter.simpledialog', + 'turtle': 'tkinter.turtle' } def check_rename(self, module_name, new_module_name): |