use main window menus texteditor __init__(selfloadfirstloadencodea frame in new popup assert self master =self popup self popup title('pyedit version wintitleself popup iconname('pyedit'self popup protocol('wm_delete_window'self onquittexteditor editwindows append(selfdef onquit(self)close not self text_edit_modified(if not closeclose askyesno('pyedit''text changedquit and discard changes?'if closeself popup destroy(kill this window only texteditor editwindows remove(self(plus any child windowsdef onclone(self)texteditor onclone(selfmakewindow=falsei make my own pop-up ########################################when editor embedded in another window ########################################class texteditorcomponent(texteditorguimakerframemenu)""attached pyedit component frames with full menu/toolbar optionswhich run destroy(on quit in the gui to erase self onlya quit in the gui verifies if any changes in self (onlyheredoes not intercept window manager border xdoesn' own windowdoes not add self to changes tracking listpart of larger app""def __init__(selfparent=noneloadfirst=''loadencode='')use frame-based menus guimaker __init__(selfparentall menusbuttons on texteditor __init__(selfloadfirstloadencodeguimaker must init st def onquit(self)close not self text_edit_modified(if not closeclose askyesno('pyedit''text changedquit and discard changes?'if closeself destroy(erase self frame but do not quit enclosing app class texteditorcomponentminimal(texteditorguimakerframemenu)""attached pyedit component frames without quit and file menu optionson startupremoves quit from toolbarand either deletes file menu or disables all its items (possibly hackishbut sufficient)menu and toolbar structures are per-instance datachanges do not impact othersquit in gui never occursbecause it is removed from available options""def __init__(selfparent=noneloadfirst=''deletefile=trueloadencode='')self deletefile deletefile guimaker __init__(selfparentguimaker frame packs self pyedita text editor program/object