self setmenubar(self settoolbar(self master title("shell tools listbox"self master iconname("shell tools"use guimaker if component def handlelist(selfevent)label self listbox get(activeself runcommand(labelon listbox double-click fetch selection text and call action here def makewidgets(self)add listbox in middle sbar scrollbar(selfcross link sbarlist list listbox(selfbg='white'or use tour scrolledlist sbar config(command=list yviewlist config(yscrollcommand=sbar setsbar pack(side=rightfill=ypack st=clip last list pack(side=leftexpand=yesfill=bothlist clipped first for (labelactionin self fetchcommands()add to listbox list insert(endlabeland menu/toolbars list bind(''self handlelistset event handler self listbox list def fortoolbar(selflabel)return true put on toolbardefault all def settoolbar(self)self toolbar [for (labelactionin self fetchcommands()if self fortoolbar(label)self toolbar append((labelactiondict(side=left))self toolbar append(('quit'self quitdict(side=right))def setmenubar(self)toolentries [self menubar ('file' [('quit'- self quit)])('tools' toolentriesfor (labelactionin self fetchcommands()toolentries append((label- action)pull-down name menu items list label,underline,action add app items to menu ###############################################################################delegate to template type-specific subclasses which delegate to app tool-set-specific subclasses ###############################################################################class listmenugui(shellgui)def fetchcommands(self)subclassset 'mymenureturn self mymenu list of (labelcallbackdef runcommand(selfcmd)for (labelactionin self mymenuif label =cmdaction(class dictmenugui(shellgui)def fetchcommands(self) gui coding techniques