be called directly without subclassdesigned to be mixed in after (further to the right thanapp-specific classeselsesubclass gets methods here (destroyokaytoquit)instead of from app-specific classes--can' redefine ##############################################################################""import osglob from tkinter import tktoplevelframeyesbothridge from tkinter messagebox import showinfoaskyesno class _window""mixin shared by main and pop-up windows ""foundicon none iconpatt 'icoiconmine 'py icoshared by all inst may be reset def configborders(selfappkindiconfile)if not iconfileiconfile self findicon(title app if kindtitle +kind self title(titleself iconname(appif iconfiletryself iconbitmap(iconfileexceptpass self protocol('wm_delete_window'self quitno icon passedtry curr,tool dirs on window border when minimized window icon image bad py or platform don' close silent def findicon(self)if _window foundiconreturn _window foundicon iconfile none iconshere glob glob(self iconpattif iconshereiconfile iconshere[ elsemymod __import__(__name__path __name__ split('for mod in path[ :]mymod getattr(mymodmodmydir os path dirname(mymod __file__myicon os path join(mydirself iconmineif os path exists(myicon)iconfile myicon _window foundicon iconfile return iconfile already found onetry curr dir first assume just one del icon for red tk try tools dir icon import self for dir poss package path follow path to end only have leftmost use myiconnot tk don' search again class mainwindow(tk_window)""when run in main top-level window ""wrapping up top-level window interfaces