| 453 | self.destroy_physically = destroy_physically |
| 454 | |
| 455 | def destroy(self): |
| 456 | # For some widgets e.g., a NoteBook, when we call destructors, |
| 457 | # we must be careful not to destroy the frame widget since this |
| 458 | # also destroys the parent NoteBook thus leading to an exception |
| 459 | # in Tkinter when it finally calls Tcl to destroy the NoteBook |
| 460 | for c in list(self.children.values()): c.destroy() |
| 461 | if self._name in self.master.children: |
| 462 | del self.master.children[self._name] |
| 463 | if self._name in self.master.subwidget_list: |
| 464 | del self.master.subwidget_list[self._name] |
| 465 | if self.destroy_physically: |
| 466 | # This is bypassed only for a few widgets |
| 467 | self.tk.call('destroy', self._w) |
| 468 | |
| 469 | |
| 470 | # Useful class to create a display style - later shared by many items. |