def setup(root, wm=''):
"""1) find the files and/or settings (::wm_default::setup).
Takes one optional argument: wm, the name of the window manager
as a string, if known. One of: windows gnome kde1 kde2 cde kde.
"""
try:
try:
# Make sure Tcl/Tk knows wm_default is installed
root.tk.eval("package require wm_default")
except:
# Try again with this directory on the Tcl/Tk path
dir = os.path.dirname (self.__file__)
root.tk.eval('global auto_path; lappend auto_path {%s}' % dir)
root.tk.eval("package require wm_default")
except:
t, v, tb = sys.exc_info()
text = "Error loading WmDefault\n"
for line in traceback.format_exception(t,v,tb): text = text + line + '\n'
try:
tkMessageBox.showerror ('WmDefault Error', text)
except:
sys.stderr.write( text )
return root.tk.call('::wm_default::setup', wm)
评论列表
文章目录