Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into the Tcl Interpreter and calls exec on the contents of .BASENAME.py and .CLASSNAME.py if such a file exists in the home directory.
(self, baseName, className)
| 2509 | _default_root = None |
| 2510 | |
| 2511 | def readprofile(self, baseName, className): |
| 2512 | """Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into |
| 2513 | the Tcl Interpreter and calls exec on the contents of .BASENAME.py and |
| 2514 | .CLASSNAME.py if such a file exists in the home directory.""" |
| 2515 | import os |
| 2516 | if 'HOME' in os.environ: home = os.environ['HOME'] |
| 2517 | else: home = os.curdir |
| 2518 | class_tcl = os.path.join(home, '.%s.tcl' % className) |
| 2519 | class_py = os.path.join(home, '.%s.py' % className) |
| 2520 | base_tcl = os.path.join(home, '.%s.tcl' % baseName) |
| 2521 | base_py = os.path.join(home, '.%s.py' % baseName) |
| 2522 | dir = {'self': self} |
| 2523 | exec('from tkinter import *', dir) |
| 2524 | if os.path.isfile(class_tcl): |
| 2525 | self.tk.call('source', class_tcl) |
| 2526 | if os.path.isfile(class_py): |
| 2527 | exec(open(class_py).read(), dir) |
| 2528 | if os.path.isfile(base_tcl): |
| 2529 | self.tk.call('source', base_tcl) |
| 2530 | if os.path.isfile(base_py): |
| 2531 | exec(open(base_py).read(), dir) |
| 2532 | |
| 2533 | def report_callback_exception(self, exc, val, tb): |
| 2534 | """Report callback exception on sys.stderr. |