3737import types
3838
3939lazy import re
40+ lazy import traceback
41+ lazy import os
4042TclError = _tkinter .TclError
4143
4244wantobjects = 1
5456
5557def _get_magic_re ():
5658 """
57- Internal function that acts as a wrapper for the re import to make it lazy
59+ Internal function that acts as a wrapper
60+ for the re import to make it lazy.
5861 """
5962 global _magic_re
6063 if _magic_re is None :
@@ -63,7 +66,8 @@ def _get_magic_re():
6366
6467def _get_space_re ():
6568 """
66- Internal function that acts as a wrapper for the re import to make it lazy
69+ Internal function that acts as a wrapper
70+ for the re import to make it lazy.
6771 """
6872 global _space_re
6973 if _space_re is None :
@@ -2540,7 +2544,6 @@ def __init__(self, screenName=None, baseName=None, className='Tk',
25402544 # ensure that self.tk is always _something_.
25412545 self .tk = None
25422546 if baseName is None :
2543- import os
25442547 baseName = os .path .basename (sys .argv [0 ])
25452548 baseName , ext = os .path .splitext (baseName )
25462549 if ext not in ('.py' , '.pyc' ):
@@ -2600,7 +2603,6 @@ def readprofile(self, baseName, className):
26002603 """Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into
26012604 the Tcl Interpreter and calls exec on the contents of .BASENAME.py and
26022605 .CLASSNAME.py if such a file exists in the home directory."""
2603- import os
26042606 if 'HOME' in os .environ : home = os .environ ['HOME' ]
26052607 else : home = os .curdir
26062608 class_tcl = os .path .join (home , '.%s.tcl' % className )
@@ -2623,7 +2625,6 @@ def report_callback_exception(self, exc, val, tb):
26232625
26242626 Applications may want to override this internal function, and
26252627 should when sys.stderr is None."""
2626- import traceback
26272628 print ("Exception in Tkinter callback" , file = sys .stderr )
26282629 sys .last_exc = val
26292630 sys .last_type = exc
0 commit comments