when text editor owns the window ##################################class texteditormain(texteditorguimakerwindowmenu)""main pyedit windows that quit(to exit app on quit in guiand build menu on windowparent may be default tkexplicit tkor toplevelparent must be windowand probably should be tk so this isn' silently destroyed and closed with parentall main pyedit windows check all other pyedit windows open in the process for changes on quit in the guisince quit(here will exit the entire appthe editor' frame need not occupy entire window (may have other partssee pyview)but its quit ends programonquit is run for quit in toolbar or file menuas well as window border ""def __init__(selfparent=noneloadfirst=''loadencode='')editor fills whole parent window guimaker __init__(selfparentuse main window menus texteditor __init__(selfloadfirstloadencodeguimaker frame packs self self master title('pyedit versiontitlewm if standalone self master iconname('pyedit'self master protocol('wm_delete_window'self onquittexteditor editwindows append(selfdef onquit(self)on quit request in the gui close not self text_edit_modified(check selfask?check others if not closeclose askyesno('pyedit''text changedquit and discard changes?'if closewindows texteditor editwindows changed [ for in windows if !self and text_edit_modified()if not changedguimaker quit(selfquit ends entire app regardless of widget type elsenumchange len(changedverify '% other edit window% changedquit and discard anyhow?verify verify (numchange'sif numchange else ''if askyesno('pyedit'verify)guimaker quit(selfclass texteditormainpopup(texteditorguimakerwindowmenu)""popup pyedit windows that destroy(to close only self on quit in guiand build menu on windowmakes own toplevel parentwhich is child to default tk (for noneor other passed-in window or widget ( frame)adds to list so will be checked for changes if any pyedit main window quitsif any pyedit main windows will be createdparent of this should also be pyedit main window' parent so this is not closed silently while being trackedonquit is run for quit in toolbar or file menuas well as window border ""def __init__(selfparent=noneloadfirst=''wintitle=''loadencode='')create own window self popup toplevel(parent complete gui programs