| 2547 | self._loadtk() |
| 2548 | |
| 2549 | def _loadtk(self): |
| 2550 | self._tkloaded = True |
| 2551 | global _default_root |
| 2552 | # Version sanity checks |
| 2553 | tk_version = self.tk.getvar('tk_version') |
| 2554 | if tk_version != _tkinter.TK_VERSION: |
| 2555 | raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)" |
| 2556 | % (_tkinter.TK_VERSION, tk_version)) |
| 2557 | # Under unknown circumstances, tcl_version gets coerced to float |
| 2558 | tcl_version = str(self.tk.getvar('tcl_version')) |
| 2559 | if tcl_version != _tkinter.TCL_VERSION: |
| 2560 | raise RuntimeError("tcl.h version (%s) doesn't match libtcl.a version (%s)" \ |
| 2561 | % (_tkinter.TCL_VERSION, tcl_version)) |
| 2562 | # Create and register the tkerror and exit commands |
| 2563 | # We need to inline parts of _register here, _ register |
| 2564 | # would register differently-named commands. |
| 2565 | if self._tclCommands is None: |
| 2566 | self._tclCommands = [] |
| 2567 | self.tk.createcommand('tkerror', _tkerror) |
| 2568 | self.tk.createcommand('exit', _exit) |
| 2569 | self._tclCommands.append('tkerror') |
| 2570 | self._tclCommands.append('exit') |
| 2571 | if _support_default_root and _default_root is None: |
| 2572 | _default_root = self |
| 2573 | self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 2574 | |
| 2575 | def destroy(self): |
| 2576 | """Destroy this and all descendants widgets. This will |