def deleteMenuItems(menu):
 try:
  lastMenuIndex = menu.index(Tkinter.END)
  if (lastMenuIndex != None):
   menu.delete(0, lastMenuIndex)
 except:
  print 'this should never happen, the lastMenuIndex in deleteMenuItems in settings could not be determined.'

def deleteMenuItems ( menu ) : try : lastMenuIndex = menu . index ( Tkinter . END ) if ( lastMenuIndex != None ) : menu . delete ( 0 , lastMenuIndex ) except : print 'this should never happen, the lastMenuIndex in deleteMenuItems in settings could not be determined.'
delete the menu items .