self-test when file run standalone'python guimaker py##############################################################################if __name__ ='__main__'from guimixin import guimixin mix in help method menubar ('file' [('open' lambda: )lambda: is no-op ('quit' sys exit)])use sysno self here ('edit' [('cut' lambda: )('paste' lambda: )]toolbar [('quit'sys exit{'side'left})class testappframemenu(guimixinguimakerframemenu)def start(self)self menubar menubar self toolbar toolbar class testappwindowmenu(guimixinguimakerwindowmenu)def start(self)self menubar menubar self toolbar toolbar class testappwindowmenubasic(guimakerwindowmenu)def start(self)self menubar menubar self toolbar toolbar guimaker helpnot guimixin root tk(testappframemenu(toplevel()testappwindowmenu(toplevel()testappwindowmenubasic(rootroot mainloop(to make sense of this moduleyou have to be familiar with the menu fundamentals introduced in if you arethoughit' straightforward--the guimaker class simply traverses the menu and toolbar structures and builds menu and toolbar widgets along the way this module' self-test code includes simple example of the data structures used to lay out menus and toolbarsmenu bar templates lists and nested sublists of (labelunderlinehandlertriples if handler is sublist rather than function or methodit is assumed to be cascading submenu toolbar templates list of (labelhandlerpack-optionstriples pack-options is coded as dictionary of options passed on to the widget pack methodwe can code these as {' ':vliteralsor with the dict( =vcall' keyword syntax pack accepts dictionary argumentbut we could also transform the dictionary into individual keyword gui coding techniques