Index: Lib/lib-tk/ttk.py =================================================================== --- Lib/lib-tk/ttk.py (revision 69260) +++ Lib/lib-tk/ttk.py (working copy) @@ -26,37 +26,20 @@ "tclobjs_to_py"] import Tkinter +import tkdeploader _flatten = Tkinter._flatten -# Verify if Tk is new enough to not need Tile checking +# Verify if Tk is new enough to not need the Tile package _REQUIRE_TILE = True if Tkinter.TkVersion < 8.5 else False -def _loadttk(loadtk): - # This extends the default Tkinter.Tk._loadtk method so we can be - # sure that ttk is available for use, or not. - def _wrapper(self): - loadtk(self) +def _add_tile_dep(): + if _REQUIRE_TILE: + tkdeploader.dependences.add('tile', + tkdeploader.basic_preloader, env_var='TILE_LIBRARY') +_add_tile_dep() - if _REQUIRE_TILE: - import os - tilelib = os.environ.get('TILE_LIBRARY') - if tilelib: - # append custom tile path to the the list of directories that - # Tcl uses when attempting to resolve packages with the package - # command - self.tk.eval('global auto_path; ' - 'lappend auto_path {%s}' % tilelib) - self.tk.eval('package require tile') # TclError may be raised here - return _wrapper - -# Store the original Tkinter.Tk._loadtk before replacing it just in case -# someone wants to restore it. -__loadtk__ = Tkinter.Tk._loadtk -Tkinter.Tk._loadtk = _loadttk(Tkinter.Tk._loadtk) - - def _format_optdict(optdict, script=False, ignore=None): """Formats optdict to a tuple to pass it to tk.call.