[Python-checkins] r64892 - in sandbox/trunk/ttk-gsoc/src/idlelib: AutoCompleteWindow.py CallTipWindow.py ColorDelegator.py Debugger.py FileList.py GrepDialog.py MultiStatusBar.py OutputWindow.py ReplaceDialog.py ScrolledList.py SearchDialog.py SearchDialogBase.py SearchEngine.py TreeWidget.py UndoDelegator.py WidgetRedirector.py WindowList.py aboutDialog.py configDialog.py configHelpSourceEdit.py configSectionNameDialog.py keybindingDialog.py tabbedpages_new.py tabbedpages_old.py textView.py

guilherme.polo python-checkins at python.org
Sat Jul 12 17:21:50 CEST 2008


Author: guilherme.polo
Date: Sat Jul 12 17:21:49 2008
New Revision: 64892

Log:
Removed "from Tkinter import *" usage from almost all modules, and removed string module usage where appropriate

Modified:
   sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py
   sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py
   sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py
   sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py
   sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py
   sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py
   sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py
   sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py
   sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py
   sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py
   sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py
   sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py
   sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py
   sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py
   sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py
   sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py
   sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py
   sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
   sandbox/trunk/ttk-gsoc/src/idlelib/textView.py

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py	Sat Jul 12 17:21:49 2008
@@ -1,13 +1,15 @@
 """
 An auto-completion window for IDLE, used by the AutoComplete extension
 """
-from Tkinter import *
-from MultiCall import MC_SHIFT
+from Tkinter import Toplevel, Listbox, Scrollbar, TclError
+from Tkconstants import END, LEFT, RIGHT, BOTH, VERTICAL, Y
+
 import AutoComplete
-from idlelib.configHandler import idleConf
+from MultiCall import MC_SHIFT
+from configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import *
+    from ttk import Scrollbar
 
 HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
 HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>")

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py	Sat Jul 12 17:21:49 2008
@@ -4,11 +4,13 @@
 Used by the CallTips IDLE extension.
 
 """
-from Tkinter import *
-from idlelib.configHandler import idleConf
+from Tkinter import Toplevel, Label, TclError
+from Tkconstants import SOLID, LEFT
+
+from configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import *
+    from ttk import Label
 
 HIDE_VIRTUAL_EVENT_NAME = "<<calltipwindow-hide>>"
 HIDE_SEQUENCES = ("<Key-Escape>", "<FocusOut>")
@@ -146,6 +148,8 @@
 #
 class container: # Conceptually an editor_window
     def __init__(self):
+        from Tkinter import Tk, Text
+        from Tkconstants import BOTH
         root = Tk()
         text = self.text = Text(root)
         text.pack(side=LEFT, fill=BOTH, expand=1)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py	Sat Jul 12 17:21:49 2008
@@ -1,8 +1,8 @@
-import time
 import re
+import time
 import keyword
 import __builtin__
-from Tkinter import *
+
 from Delegator import Delegator
 from configHandler import idleConf
 
@@ -248,6 +248,7 @@
             self.tag_remove(tag, "1.0", "end")
 
 def main():
+    from Tkinter import Tk, Text
     from Percolator import Percolator
     root = Tk()
     root.wm_protocol("WM_DELETE_WINDOW", root.quit)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py	Sat Jul 12 17:21:49 2008
@@ -1,14 +1,17 @@
 import os
 import bdb
 import types
-from Tkinter import *
+from Tkinter import Frame, Button, Entry, Checkbutton, Label, Scrollbar, \
+                    Canvas, BooleanVar
+from Tkconstants import W, LEFT, DISABLED, X, Y, BOTH, NW, GROOVE, RIGHT
+
+import macosxSupport
 from WindowList import ListedToplevel
 from ScrolledList import ScrolledList
 from configHandler import idleConf
-import macosxSupport
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import Scrollbar, Button, Radiobutton
+    from ttk import Frame, Button, Entry, Checkbutton, Label, Scrollbar
 
 class Idb(bdb.Bdb):
 
@@ -95,7 +98,7 @@
         self.top.bind("<Escape>", self.close)
         #
         self.bframe = bframe = Frame(top)
-        self.bframe.pack(anchor="w")
+        self.bframe.pack(anchor=W)
         self.buttons = bl = []
         #
         self.bcont = b = Button(bframe, text="Go", command=self.cont)
@@ -110,11 +113,11 @@
         bl.append(b)
         #
         for b in bl:
-            b.configure(state="disabled")
-            b.pack(side="left")
+            b.configure(state=DISABLED)
+            b.pack(side=LEFT)
         #
         self.cframe = cframe = Frame(bframe)
-        self.cframe.pack(side="left")
+        self.cframe.pack(side=LEFT)
         #
         if not self.vstack:
             self.__class__.vstack = BooleanVar(top)
@@ -139,18 +142,18 @@
             text="Globals", command=self.show_globals, variable=self.vglobals)
         self.bglobals.grid(row=1, column=1)
         #
-        self.status = Label(top, anchor="w")
-        self.status.pack(anchor="w")
-        self.error = Label(top, anchor="w")
-        self.error.pack(anchor="w", fill="x")
+        self.status = Label(top, anchor=W)
+        self.status.pack(anchor=W)
+        self.error = Label(top, anchor=W)
+        self.error.pack(anchor=X, fill=X)
         self.errorbg = self.error.cget("background")
         #
         self.fstack = Frame(top, height=1)
-        self.fstack.pack(expand=1, fill="both")
+        self.fstack.pack(expand=1, fill=BOTH)
         self.flocals = Frame(top)
-        self.flocals.pack(expand=1, fill="both")
+        self.flocals.pack(expand=1, fill=BOTH)
         self.fglobals = Frame(top, height=1)
-        self.fglobals.pack(expand=1, fill="both")
+        self.fglobals.pack(expand=1, fill=BOTH)
         #
         if self.vstack.get():
             self.show_stack()
@@ -352,8 +355,7 @@
             funcname = code.co_name
             import linecache
             sourceline = linecache.getline(filename, lineno)
-            import string
-            sourceline = string.strip(sourceline)
+            sourceline = sourceline.strip()
             if funcname in ("?", "", None):
                 item = "%s, line %d: %s" % (modname, lineno, sourceline)
             else:
@@ -423,19 +425,19 @@
         self.repr.maxstring = 60
         self.repr.maxother = 60
         self.frame = frame = Frame(master)
-        self.frame.pack(expand=1, fill="both")
-        self.label = Label(frame, text=title, borderwidth=2, relief="groove")
-        self.label.pack(fill="x")
+        self.frame.pack(expand=1, fill=BOTH)
+        self.label = Label(frame, text=title, borderwidth=2, relief=GROOVE)
+        self.label.pack(fill=X)
         self.vbar = vbar = Scrollbar(frame, name="vbar")
-        vbar.pack(side="right", fill="y")
+        vbar.pack(side=RIGHT, fill=Y)
         self.canvas = canvas = Canvas(frame,
                                       height=min(300, max(40, height)),
                                       scrollregion=(0, 0, width, height))
-        canvas.pack(side="left", fill="both", expand=1)
+        canvas.pack(side=LEFT, fill=BOTH, expand=1)
         vbar["command"] = canvas.yview
         canvas["yscrollcommand"] = vbar.set
         self.subframe = subframe = Frame(canvas)
-        self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
+        self.sfid = canvas.create_window(0, 0, window=subframe, anchor=NW)
         self.load_dict(dict)
 
     dict = -1
@@ -463,10 +465,10 @@
                 if rpc_client:
                     svalue = svalue[1:-1]
                 l = Label(subframe, text=name)
-                l.grid(row=row, column=0, sticky="nw")
+                l.grid(row=row, column=0, sticky=NW)
                 l = Entry(subframe, width=0, borderwidth=0)
                 l.insert(0, svalue)
-                l.grid(row=row, column=1, sticky="nw")
+                l.grid(row=row, column=1, sticky=NW)
                 row = row+1
         self.dict = dict
         # XXX Could we use a <Configure> callback for the following?

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py	Sat Jul 12 17:21:49 2008
@@ -1,5 +1,4 @@
 import os
-from Tkinter import *
 import tkMessageBox
 
 
@@ -106,8 +105,9 @@
 
 
 def _test():
-    from EditorWindow import fixwordbreaks
     import sys
+    from Tkinter import Tk
+    from EditorWindow import fixwordbreaks
     root = Tk()
     fixwordbreaks(root)
     root.withdraw()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py	Sat Jul 12 17:21:49 2008
@@ -1,13 +1,14 @@
 import os
-import fnmatch
 import sys
-from Tkinter import *
+import fnmatch
+from Tkinter import StringVar, BooleanVar, Checkbutton
+
 import SearchEngine
 from SearchDialogBase import SearchDialogBase
-from idlelib.configHandler import idleConf
+from configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import *
+    from ttk import Checkbutton
 
 def grep(text, io=None, flist=None):
     root = text._root()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py	Sat Jul 12 17:21:49 2008
@@ -1,5 +1,7 @@
-from Tkinter import *
-from idlelib.configHandler import idleConf
+from Tkinter import Tk, Frame, Label
+from Tkconstants import LEFT, SUNKEN, W
+
+from configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
     from ttk import Frame, Label
@@ -22,6 +24,8 @@
         label.config(text=text)
 
 def _test():
+    from Tkinter import Text
+    from Tkconstants import TOP, BOTTOM, X
     b = Frame()
     c = Text(b)
     c.pack(side=TOP)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py	Sat Jul 12 17:21:49 2008
@@ -1,8 +1,8 @@
-from Tkinter import *
-from EditorWindow import EditorWindow
 import re
 import tkMessageBox
+
 import IOBinding
+from EditorWindow import EditorWindow
 
 class OutputWindow(EditorWindow):
 

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py	Sat Jul 12 17:21:49 2008
@@ -1,4 +1,5 @@
-from Tkinter import *
+from Tkinter import StringVar, TclError
+
 import SearchEngine
 from SearchDialogBase import SearchDialogBase
 

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py	Sat Jul 12 17:21:49 2008
@@ -1,8 +1,8 @@
-from Tkinter import *
+from Tkinter import Frame, Menu, Listbox, Scrollbar
 from idlelib.configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import *
+    from ttk import Frame, Scrollbar
 
 class ScrolledList:
 
@@ -124,6 +124,7 @@
 
 
 def test():
+    from Tkinter import Tk
     root = Tk()
     root.protocol("WM_DELETE_WINDOW", root.destroy)
     class MyScrolledList(ScrolledList):

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py	Sat Jul 12 17:21:49 2008
@@ -1,8 +1,8 @@
-from Tkinter import *
+from Tkinter import TclError
+
 import SearchEngine
 from SearchDialogBase import SearchDialogBase
 
-
 def _setup(text):
     root = text._root()
     engine = SearchEngine.get(root)
@@ -12,7 +12,7 @@
 
 def find(text):
     pat = text.get("sel.first", "sel.last")
-    return _setup(text).open(text,pat)
+    return _setup(text).open(text, pat)
 
 def find_again(text):
     return _setup(text).find_again(text)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py	Sat Jul 12 17:21:49 2008
@@ -1,8 +1,10 @@
-from Tkinter import *
-from idlelib.configHandler import idleConf
+from Tkinter import Toplevel, Frame, Label, Entry, Button, Checkbutton, \
+                    Radiobutton
+
+from configHandler import idleConf
 
 if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-    from ttk import *
+    from ttk import Frame, Label, Entry, Button, Checkbutton, Radiobutton
 
 class SearchDialogBase:
 
@@ -43,7 +45,7 @@
         top.protocol("WM_DELETE_WINDOW", self.close)
         top.wm_title(self.title)
         top.wm_iconname(self.icon)
-        top.resizable(height=FALSE,width=FALSE)
+        top.resizable(height=False, width=False)
         self.ttop = top
         self.top = Frame(top)
 

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py	Sat Jul 12 17:21:49 2008
@@ -1,5 +1,5 @@
 import re
-from Tkinter import *
+from Tkinter import StringVar, BooleanVar, TclError
 import tkMessageBox
 
 def get(root):

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py	Sat Jul 12 17:21:49 2008
@@ -15,17 +15,15 @@
 # - optimize tree redraw after expand of subnode
 
 import os
-from Tkinter import *
-import imp
+from Tkinter import Tk, Label, Entry, Frame, Canvas, Scrollbar, PhotoImage
+from Tkconstants import ALL, END
 
 import ZoomHeight
 from configHandler import idleConf
 
-from idlelib.configHandler import idleConf
-
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Label, Entry, Frame, Scrollbar
 
 ICONDIR = "Icons"
 
@@ -462,6 +460,7 @@
 # XXX Can't run these tests
 
 def test():
+    from Tkinter import Toplevel
     import PyShell
     root = Toplevel(PyShell.root)
     root.configure(bd=0, bg="yellow")

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py	Sat Jul 12 17:21:49 2008
@@ -1,5 +1,5 @@
 import string
-from Tkinter import *
+
 from Delegator import Delegator
 
 #$ event <<redo>>
@@ -336,6 +336,7 @@
         return self.depth
 
 def main():
+    from Tkinter import Tk, Text
     from Percolator import Percolator
     root = Tk()
     root.wm_protocol("WM_DELETE_WINDOW", root.quit)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py	Sat Jul 12 17:21:49 2008
@@ -1,4 +1,4 @@
-from Tkinter import *
+from Tkinter import TclError
 
 class WidgetRedirector:
 
@@ -105,6 +105,7 @@
 
 
 def main():
+    from Tkinter import Tk, Text
     root = Tk()
     root.wm_protocol("WM_DELETE_WINDOW", root.quit)
     text = Text()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py	Sat Jul 12 17:21:49 2008
@@ -1,4 +1,4 @@
-from Tkinter import *
+from Tkinter import Toplevel, TclError
 
 class WindowList:
 
@@ -45,8 +45,8 @@
             try:
                 callback()
             except:
-                print "warning: callback failed in WindowList", \
-                      sys.exc_type, ":", sys.exc_value
+                print ("warning: callback failed in WindowList",
+                    sys.exc_type, ":", sys.exc_value)
 
 registry = WindowList()
 

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py	Sat Jul 12 17:21:49 2008
@@ -1,16 +1,17 @@
 """About Dialog for IDLE"""
-from Tkinter import *
 import os
-import os.path
-import textView
-import idlever
+import sys
+from Tkinter import Toplevel, Frame, Button, Label, TkVersion
+from Tkconstants import LEFT, NSEW, SUNKEN, EW, W, BOTH, TOP, BOTTOM
 
-from idlelib.stylist import PoorManStyle
-from idlelib.configHandler import idleConf
+import idlever
+import textView
+from stylist import PoorManStyle
+from configHandler import idleConf
 
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Frame, Button, Label, Style
 
 class AboutDialog(Toplevel):
     """Modal about dialog for idle
@@ -27,7 +28,7 @@
  
         self.SetupStyles()
         self.CreateWidgets()
-        self.resizable(height=FALSE, width=FALSE)
+        self.resizable(height=False, width=False)
         self.title(title)
         self.transient(parent)
         self.grab_set()
@@ -55,11 +56,11 @@
         frameMain = Frame(self, borderwidth=2, relief=SUNKEN)
         frameButtons = Frame(self)
         frameButtons.pack(side=BOTTOM, pady=3)
-        frameMain.pack(side=TOP, expand=TRUE, fill=BOTH)
+        frameMain.pack(side=TOP, expand=True, fill=BOTH)
         self.buttonOk = Button(frameButtons, text='Close', command=self.Ok)
         self.buttonOk.pack()
         frameBg = Frame(frameMain)
-        frameBg.pack(expand=TRUE, fill=BOTH)
+        frameBg.pack(expand=True, fill=BOTH)
         labelTitle = Label(frameBg, text='IDLE', font=('courier', 24, 'bold'))
         labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10)
         byline = "Python's Integrated DeveLopment Environment" + 5*'\n'
@@ -159,9 +160,9 @@
 
 if __name__ == '__main__':
     # test the dialog
+    from Tkinter import Tk
     root = Tk()
     def run():
-        import aboutDialog
-        aboutDialog.AboutDialog(root, 'About')
+        AboutDialog(root, 'About')
     Button(root, text='Dialog', command=run).pack()
     root.mainloop()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py	Sat Jul 12 17:21:49 2008
@@ -8,21 +8,26 @@
 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 *
+from Tkinter import Toplevel, Frame, Button, Scale, Label, LabelFrame, Text, \
+                    Listbox, Scrollbar, Checkbutton, Radiobutton, Entry, \
+                    StringVar, BooleanVar, IntVar
+from Tkconstants import LEFT, RIGHT, BOTTOM, TOP, BOTH, GROOVE, SOLID, NONE, \
+                        END, DISABLED, NSEW, Y, X, W, E, HORIZONTAL, NS, EW, \
+                        ANCHOR, NORMAL
 import tkMessageBox, tkColorChooser, tkFont
-import string
 
-from configHandler import idleConf
-from dynOptionMenuWidget import DynOptionMenu
+from stylist import PoorManStyle
 from tabbedpages import TabbedPageSet
+from configHandler import idleConf
 from keybindingDialog import GetKeysDialog
-from configSectionNameDialog import GetCfgSectionNameDialog
+from dynOptionMenuWidget import DynOptionMenu
 from configHelpSourceEdit import GetHelpSourceDialog
-from stylist import PoorManStyle
+from configSectionNameDialog import GetCfgSectionNameDialog
 
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Frame, Button, Checkbutton, LabelFrame, LabeledScale, \
+                    Combobox, Entry, Radiobutton, Scrollbar, Label, Style
 
 class ConfigDialog(Toplevel):
 
@@ -31,8 +36,8 @@
         self.wm_withdraw()
 
         self.configure(borderwidth=5)
-        self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
-                parent.winfo_rooty()+30))
+        self.geometry("+%d+%d" % (parent.winfo_rootx() + 20,
+            parent.winfo_rooty() + 30))
         #Theme Elements. Each theme element key is its display name.
         #The first value of the tuple is the sample area tag name.
         #The second value is the display name list sort index.
@@ -53,7 +58,7 @@
         self.ResetChangedItems() #load initial values in changed items dict
         self.SetupStyles()
         self.CreateWidgets()
-        self.resizable(height=FALSE,width=FALSE)
+        self.resizable(height=False, width=False)
         self.transient(parent)
         self.grab_set()
         self.protocol("WM_DELETE_WINDOW", self.Cancel)
@@ -86,17 +91,17 @@
 
     def CreateWidgets(self):
         self.tabPages = TabbedPageSet(self,
-                page_names=['Fonts/Tabs','Highlighting','Keys','General'])
+            page_names=['Fonts/Tabs','Highlighting','Keys','General'])
         frameActionButtons = Frame(self)
         #action buttons
         self.buttonHelp = Button(frameActionButtons,text='Help',
-                command=self.Help, takefocus=FALSE)
+                command=self.Help, takefocus=False)
         self.buttonOk = Button(frameActionButtons, text='Ok',
-                command=self.Ok, takefocus=FALSE)
+                command=self.Ok, takefocus=False)
         self.buttonApply = Button(frameActionButtons, text='Apply',
-                command=self.Apply, takefocus=FALSE)
+                command=self.Apply, takefocus=False)
         self.buttonCancel = Button(frameActionButtons, text='Cancel',
-                command=self.Cancel, takefocus=FALSE)
+                command=self.Cancel, takefocus=False)
 
         # Apply styles
         s = self.style
@@ -114,9 +119,9 @@
         self.buttonApply.pack(side=RIGHT, pady=6)
         self.buttonOk.pack(side=RIGHT, padx=6, pady=6)
         self.buttonCancel.pack(side=RIGHT, pady=6)
-        frameActionButtons.pack(side=BOTTOM, fill=X, expand=TRUE)
+        frameActionButtons.pack(side=BOTTOM, fill=X, expand=True)
         Frame(self, height=2, borderwidth=0).pack(side=BOTTOM)
-        self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH)
+        self.tabPages.pack(side=TOP,expand=True,fill=BOTH)
 
     def CreatePageFontTab(self):
         #tkVars
@@ -138,8 +143,8 @@
         frameFontParam=Frame(frameFont)
         labelFontNameTitle=Label(frameFontName,justify=LEFT,
                 text='Font Face :')
-        self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE,
-                exportselection=FALSE)
+        self.listFontName=Listbox(frameFontName,height=5,takefocus=False,
+                exportselection=False)
         self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease)
         scrollFont=Scrollbar(frameFontName)
         scrollFont.config(command=self.listFontName.yview)
@@ -159,18 +164,18 @@
                                  text='Python Standard: 4 Spaces!')
         #widget packing
         #body
-        frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameFont.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH)
         frameIndent.pack(side=LEFT,padx=5,pady=5,fill=Y)
         #frameFont
         frameFontName.pack(side=TOP,padx=5,pady=5,fill=X)
         frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X)
         labelFontNameTitle.pack(side=TOP,anchor=W)
-        self.listFontName.pack(side=LEFT,expand=TRUE,fill=X)
+        self.listFontName.pack(side=LEFT,expand=True,fill=X)
         scrollFont.pack(side=LEFT,fill=Y)
         labelFontSizeTitle.pack(side=LEFT,anchor=W)
         self.optMenuFontSize.pack(side=LEFT,anchor=W)
         checkFontBold.pack(side=LEFT,anchor=W,padx=20)
-        frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameFontSample.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH)
         self.labelFontSample.pack(expand=1, fill=Y)
         #frameIndent
         frameIndentSize.pack(side=TOP,fill=X)
@@ -206,7 +211,7 @@
         #frameCustom
         self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
             font=('courier',12,''), cursor='hand2', width=21, height=11,
-            takefocus=FALSE,highlightthickness=0,wrap=NONE)
+            takefocus=False,highlightthickness=0,wrap=NONE)
         text=self.textHighlightSample
         text.bind('<Double-Button-1>',lambda e: 'break')
         text.bind('<B1-Motion>',lambda e: 'break')
@@ -258,15 +263,15 @@
                 command=self.DeleteCustomTheme)
         ##widget packing
         #body
-        frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameCustom.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH)
         frameTheme.pack(side=LEFT,padx=5,pady=5,fill=Y)
         #frameCustom
-        self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X)
+        self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=True,fill=X)
         frameFgBg.pack(side=TOP,padx=5,pady=0)
-        self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,
+        self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=True,
             fill=BOTH)
-        buttonSetColour.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=4)
-        self.optMenuHighlightTarget.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=3)
+        buttonSetColour.pack(side=TOP,expand=True,fill=X,padx=8,pady=4)
+        self.optMenuHighlightTarget.pack(side=TOP,expand=True,fill=X,padx=8,pady=3)
         self.radioFg.pack(side=LEFT,anchor=E)
         self.radioBg.pack(side=RIGHT,anchor=W)
         buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5)
@@ -299,8 +304,8 @@
         labelTargetTitle=Label(frameTarget,text='Action - Key(s)')
         scrollTargetY=Scrollbar(frameTarget)
         scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL)
-        self.listBindings=Listbox(frameTarget,takefocus=FALSE,
-                exportselection=FALSE)
+        self.listBindings=Listbox(frameTarget,takefocus=False,
+                exportselection=False)
         self.listBindings.bind('<ButtonRelease-1>',self.KeyBindingSelected)
         scrollTargetY.config(command=self.listBindings.yview)
         scrollTargetX.config(command=self.listBindings.xview)
@@ -328,11 +333,11 @@
                 text='Save as New Custom Key Set',command=self.SaveAsNewKeySet)
         ##widget packing
         #body
-        frameCustom.pack(side=BOTTOM,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameCustom.pack(side=BOTTOM,padx=5,pady=5,expand=True,fill=BOTH)
         frameKeySets.pack(side=BOTTOM,padx=5,pady=5,fill=BOTH)
         #frameCustom
         self.buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5)
-        frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameTarget.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH)
         #frame target
         frameTarget.columnconfigure(0,weight=1)
         frameTarget.rowconfigure(1,weight=1)
@@ -420,8 +425,8 @@
         frameHelpList=Frame(frameHelp)
         frameHelpListButtons=Frame(frameHelpList)
         scrollHelpList=Scrollbar(frameHelpList)
-        self.listHelp=Listbox(frameHelpList,height=5,takefocus=FALSE,
-                exportselection=FALSE)
+        self.listHelp=Listbox(frameHelpList,height=5,takefocus=False,
+                exportselection=False)
         scrollHelpList.config(command=self.listHelp.yview)
         self.listHelp.config(yscrollcommand=scrollHelpList.set)
         self.listHelp.bind('<ButtonRelease-1>',self.HelpSourceSelected)
@@ -440,7 +445,7 @@
         frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X)
         if TTK:
             frameTheme.pack(side=TOP, padx=5, pady=5, fill=X)
-        frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameHelp.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH)
         #frameRun
         labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
         radioStartupShell.pack(side=RIGHT,anchor=W,padx=5,pady=5)
@@ -469,9 +474,9 @@
             comboTheme.pack(side=RIGHT, anchor=E, padx=5, pady=5)
         #frameHelp
         frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y)
-        frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
+        frameHelpList.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH)
         scrollHelpList.pack(side=RIGHT,anchor=W,fill=Y)
-        self.listHelp.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH)
+        self.listHelp.pack(side=LEFT,anchor=E,expand=True,fill=BOTH)
         self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5)
         self.buttonHelpListAdd.pack(side=TOP,anchor=W)
         self.buttonHelpListRemove.pack(side=TOP,anchor=W,pady=5)
@@ -709,7 +714,7 @@
         newKeys={}
         for event in prevKeys.keys(): #add key set to changed items
             eventName=event[2:-2] #trim off the angle brackets
-            binding=string.join(prevKeys[event])
+            binding=' '.join(prevKeys[event])
             newKeys[eventName]=binding
         #handle any unsaved changes to prev key set
         if prevKeySetName in self.changedItems['keys'].keys():
@@ -736,7 +741,7 @@
         bindNames.sort()
         self.listBindings.delete(0,END)
         for bindName in bindNames:
-            key=string.join(keySet[bindName]) #make key(s) into a string
+            key=' '.join(keySet[bindName]) #make key(s) into a string
             bindName=bindName[2:-2] #trim off the angle brackets
             if keySetName in self.changedItems['keys'].keys():
                 #handle any unsaved changes to this key set
@@ -974,7 +979,7 @@
         self.changedItems['main']['HelpFiles'] = {}
         for num in range(1,len(self.userHelpList)+1):
             self.AddChangedItem('main','HelpFiles',str(num),
-                    string.join(self.userHelpList[num-1][:2],';'))
+                ';'.join(self.userHelpList[num - 1][:2]))
 
     def LoadFontCfg(self):
         ##base editor font selection list
@@ -1204,6 +1209,7 @@
         pass
 
 if __name__ == '__main__':
+    from Tkinter import Tk
     #test the dialog
     root=Tk()
     Button(root,text='Dialog',

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py	Sat Jul 12 17:21:49 2008
@@ -1,15 +1,16 @@
 "Dialog to specify or edit the parameters for a user configured help source."
 import os
 import sys
-from Tkinter import *
+from Tkinter import Toplevel, Frame, Entry, Button, Label, StringVar
+from Tkconstants import GROOVE, LEFT, RIGHT, W, ACTIVE, X, BOTH, TOP, BOTTOM
 import tkMessageBox
 import tkFileDialog
 
-from idlelib.configHandler import idleConf
+from configHandler import idleConf
 
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Frame, Entry, Button, Label
 
 class GetHelpSourceDialog(Toplevel):
     def __init__(self, parent, title, menuItem='', filePath=''):
@@ -22,7 +23,7 @@
         """
         Toplevel.__init__(self, parent)
         self.configure(borderwidth=5)
-        self.resizable(height=FALSE, width=FALSE)
+        self.resizable(height=False, width=False)
         self.title(title)
         self.transient(parent)
         self.grab_set()
@@ -68,7 +69,7 @@
 
         self.entryMenu.focus_set()
 
-        self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH)
+        self.frameMain.pack(side=TOP, expand=True, fill=BOTH)
         labelMenu.pack(anchor=W, padx=5, pady=3)
         self.entryMenu.pack(anchor=W, padx=5, pady=3, fill=X)
         labelPath.pack(anchor=W, padx=5, pady=3)
@@ -167,6 +168,7 @@
         self.destroy()
 
 if __name__ == '__main__':
+    from Tkinter import Tk
     #test the dialog
     root = Tk()
     def run():

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py	Sat Jul 12 17:21:49 2008
@@ -2,14 +2,15 @@
 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 *
+from Tkinter import Toplevel, Entry, Frame, Label, Button, StringVar
+from Tkconstants import TOP, BOTTOM, RIGHT, BOTH, SUNKEN, X
 import tkMessageBox
 
-from idlelib.configHandler import idleConf
+from configHandler import idleConf
 
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Entry, Frame, Label, Button
 
 class GetCfgSectionNameDialog(Toplevel):
     def __init__(self, parent, title, message, usedNames):
@@ -19,7 +20,7 @@
         """
         Toplevel.__init__(self, parent)
         self.configure(borderwidth=5)
-        self.resizable(height=FALSE, width=FALSE)
+        self.resizable(height=False, width=False)
         self.title(title)
         self.transient(parent)
         self.grab_set()
@@ -52,7 +53,7 @@
 
         entryName.focus_set()
 
-        self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH)
+        self.frameMain.pack(side=TOP, expand=True, fill=BOTH)
         self.messageInfo.pack(padx=5, pady=5)
         entryName.pack(padx=5, pady=5)
         frameButtons.pack(side=BOTTOM, fill=X)
@@ -98,11 +99,12 @@
         self.destroy()
 
 if __name__ == '__main__':
+    from Tkinter import Tk
     #test the dialog
     def run():
         keySeq = ''
         dlg = GetCfgSectionNameDialog(root, 'Get Name',
-            'The information here should need to be word wrapped. Test.')
+            'The information here should need to be word wrapped. Test.', [])
         print dlg.result
 
     root=Tk()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py	Sat Jul 12 17:21:49 2008
@@ -1,15 +1,17 @@
 """
 Dialog for building Tkinter accelerator key bindings
 """
-from Tkinter import *
+from Tkinter import Toplevel, Frame, Entry, Button, Checkbutton, Label, \
+                    Listbox, Scrollbar, StringVar
+from Tkconstants import TOP, BOTH, BOTTOM, X, NSEW, SUNKEN, LEFT, GROOVE, W, \
+                        END, EW, NS, SINGLE, VERTICAL, ANCHOR, MOVETO
 import tkMessageBox
 import string
 
 from idlelib.configHandler import idleConf
-
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Frame, Entry, Button, Checkbutton, Label, Scrollbar
 
 class GetKeysDialog(Toplevel):
     def __init__(self,parent,title,action,currentKeySequences):
@@ -21,7 +23,7 @@
         """
         Toplevel.__init__(self, parent)
         self.configure(borderwidth=5)
-        self.resizable(height=FALSE,width=FALSE)
+        self.resizable(height=False, width=False)
         self.title(title)
         self.transient(parent)
         self.grab_set()
@@ -52,10 +54,10 @@
         self.wait_window()
 
     def CreateWidgets(self):
-        frameMain = Frame(self,borderwidth=2,relief=SUNKEN)
-        frameMain.pack(side=TOP,expand=TRUE,fill=BOTH)
+        frameMain = Frame(self, borderwidth=2, relief=SUNKEN)
+        frameMain.pack(side=TOP, expand=True, fill=BOTH)
         frameButtons=Frame(self)
-        frameButtons.pack(side=BOTTOM,fill=X)
+        frameButtons.pack(side=BOTTOM, fill=X)
         self.buttonOK = Button(frameButtons,text='OK',
                 width=8,command=self.OK)
         self.buttonOK.grid(row=0,column=0,padx=5,pady=5)
@@ -172,7 +174,7 @@
         if finalKey:
             finalKey = self.TranslateKey(finalKey, modifiers)
             keyList.append(finalKey)
-        self.keyString.set('<' + string.join(keyList,'-') + '>')
+        self.keyString.set('<%s>' % '-'.join(keyList))
 
     def GetModifiers(self):
         modList = [variable.get() for variable in self.modifier_vars]
@@ -267,6 +269,7 @@
         return keysOK
 
 if __name__ == '__main__':
+    from Tkinter import Tk
     #test the dialog
     root=Tk()
     def run():

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py	Sat Jul 12 17:21:49 2008
@@ -2,8 +2,7 @@
 
 TabbedPageSet -- A custom ttk.Notebook used by IDLE.
 """
-from Tkinter import *
-from ttk import *
+from ttk import Frame, Notebook
 
 class InvalidNameError(Exception): pass
 class AlreadyExistsError(Exception): pass
@@ -64,12 +63,15 @@
         self.event_generate('<Expose>')
 
 if __name__ == '__main__':
+    from Tkinter import Tk
+    from Tkconstants import TOP, BOTH
+    from ttk import Label, Entry, Button, Style
     # test dialog
     root=Tk()
     style = Style()
     style.configure('C.TLabel', padding=20)
     tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'])
-    tabPage.pack(side=TOP, expand=TRUE, fill=BOTH)
+    tabPage.pack(side=TOP, expand=True, fill=BOTH)
     Label(tabPage.pages['Foobar'].frame, text='Foo', style='C.TLabel').pack()
     Label(tabPage.pages['Foobar'].frame, text='Bar', style='C.TLabel').pack()
     Label(tabPage.pages['Baz'].frame, text='Baz').pack()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py	Sat Jul 12 17:21:49 2008
@@ -7,7 +7,8 @@
 TabSet -- A widget containing tabs (buttons) in one or more rows.
 
 """
-from Tkinter import *
+from Tkinter import Frame, Radiobutton
+from Tkconstants import BOTH, TOP, X, RAISED, NSEW, FLAT, LEFT
 
 class InvalidNameError(Exception): pass
 class AlreadyExistsError(Exception): pass
@@ -78,7 +79,7 @@
     def remove_tab(self, tab_name):
         """Remove the tab named <tab_name>"""
         if not tab_name in self._tab_names:
-            raise KeyError("No such Tab: '%s" % page_name)
+            raise KeyError("No such Tab: '%s" % tab_name)
 
         self._tab_names.remove(tab_name)
         self._arrange_tabs()
@@ -88,7 +89,7 @@
         if tab_name == self._selected_tab:
             return
         if tab_name is not None and tab_name not in self._tabs:
-            raise KeyError("No such Tab: '%s" % page_name)
+            raise KeyError("No such Tab: '%s" % tab_name)
 
         # deselect the current selected tab
         if self._selected_tab is not None:
@@ -195,7 +196,7 @@
 
             self.button = Radiobutton(
                 self, text=name, command=self._select_event,
-                padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE,
+                padx=5, pady=1, takefocus=False, indicatoron=False,
                 highlightthickness=0, selectcolor='', borderwidth=0)
             self.button.pack(side=LEFT, fill=X, expand=True)
 
@@ -468,12 +469,13 @@
         self._tab_set.set_selected_tab(page_name)
 
 if __name__ == '__main__':
+    from Tkinter import Tk, Label, Entry, Button
     # test dialog
     root=Tk()
     tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0,
                           expand_tabs=False,
                           )
-    tabPage.pack(side=TOP, expand=TRUE, fill=BOTH)
+    tabPage.pack(side=TOP, expand=True, fill=BOTH)
     Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack()
     Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack()
     Label(tabPage.pages['Baz'].frame, text='Baz').pack()

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/textView.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/textView.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/textView.py	Sat Jul 12 17:21:49 2008
@@ -1,12 +1,15 @@
 """Simple text browser for IDLE"""
 
 import tkMessageBox
-from Tkinter import *
-from idlelib.configHandler import idleConf
+from Tkinter import Toplevel, Frame, Button, Scrollbar, Text
+from Tkconstants import DISABLED, SUNKEN, VERTICAL, WORD, RIGHT, Y, TOP, \
+                        LEFT, BOTH, BOTTOM
+
+from configHandler import idleConf
 
 TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
 if TTK:
-    from ttk import *
+    from ttk import Frame, Button, Scrollbar
 
 class TextViewer(Toplevel):
     """A simple text viewer dialog for IDLE
@@ -43,18 +46,18 @@
         frameText = Frame(self, relief=SUNKEN, height=700)
         frameButtons = Frame(self)
         self.buttonOk = Button(frameButtons, text='Close',
-                               command=self.Ok, takefocus=FALSE)
+                               command=self.Ok, takefocus=False)
         self.scrollbarView = Scrollbar(frameText, orient=VERTICAL,
-                                       takefocus=FALSE)
+                                       takefocus=False)
         self.textView = Text(frameText, wrap=WORD, fg=self.fg, bg=self.bg,
                              highlightthickness=0)
         self.scrollbarView.config(command=self.textView.yview)
         self.textView.config(yscrollcommand=self.scrollbarView.set)
         self.buttonOk.pack()
         self.scrollbarView.pack(side=RIGHT,fill=Y)
-        self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH)
+        self.textView.pack(side=LEFT,expand=True,fill=BOTH)
         frameButtons.pack(side=BOTTOM)
-        frameText.pack(side=TOP,expand=TRUE,fill=BOTH)
+        frameText.pack(side=TOP,expand=True,fill=BOTH)
 
         if TTK:
             frameButtons['style'] = 'RootColor.TFrame'
@@ -74,7 +77,6 @@
         else:
             textFile = open(filename, 'r')
     except IOError:
-        import tkMessageBox
         tkMessageBox.showerror(title='File Load Error',
                                message='Unable to load file %r .' % filename,
                                parent=parent)
@@ -83,6 +85,7 @@
 
 
 if __name__ == '__main__':
+    from Tkinter import Tk
     #test the dialog
     root=Tk()
     root.title('textView test')


More information about the Python-checkins mailing list