def runcommand(selfcmd)self mymenu[cmd](the shellgui class in this module knows how to use the guimaker and guimixin interfaces to construct selection window that displays tool names in menusa scrolled listand toolbar it also provides fortoolbar method that you can override and that allows subclasses to specify which tools should and should not be added to the window' toolbar (the toolbar can become crowded in hurryhoweverit is deliberately ignorant about both the names of tools that should be displayed in those places and about the actions to be run when tool names are selected insteadshellgui relies on the listmenugui and dictmenugui subclasses in this file to provide list of tool names from fetchcommands method and dispatch actions by name in runcommand method these two subclasses really just serve to interface to application-specific tool sets laid out as lists or dictionariesthoughthey are still naive about what tool names really go up on the gui that' by designtoo--because the tool sets displayed are defined by lower subclasseswe can use shellgui to display variety of different tool sets application-specific tool set classes to get to the actual tool setswe need to go one level down the module in example - defines subclasses of the two type-specific shellgui classesto provide sets of available tools in both list and dictionary formats (you would normally need only onebut this module is meant for illustrationthis is also the module that is actually run to kick off the gui--the shellgui module is class library only example - pp \gui\shellgui\mytools py #!/usr/local/bin/python ""###############################################################################provide type-specific option sets for application ###############################################################################""from shellgui import from packdlg import runpackdialog from unpkdlg import rununpackdialog type-specific option gui dialogs for data entry they both run app classes class textpak (listmenugui)def __init__(self)self mymenu [('pack 'runpackdialog)('unpack'rununpackdialog)('mtool 'self notdone)listmenugui __init__(selfdef fortoolbar(selflabel)return label in {'pack ''unpack'simple functions use same width here method from guimixin set syntax shellguiguis for command-line tools