def processmenu(screen, menu, parent=None, status_bottom = 'Uninitialized...'):
curses.init_pair(1,curses.COLOR_BLACK, curses.COLOR_WHITE)
curses.curs_set(0)
status_mid = ''
optioncount = len(menu['options'])
exitmenu = False
# response = None
while not exitmenu: #Loop until the user exits the menu
getin = runmenu(screen, menu, parent, status_mid, status_bottom)
if getin == optioncount:
exitmenu = True
elif menu['options'][getin]['type'] == COMMAND:
screen.clear() #clears previous screen
status_mid, status_bottom = processrequest(menu['options'][getin], screen) # Add additional space
## Show the updated status
screen.clear() #clears previous screen on key press and updates display based on pos
elif menu['options'][getin]['type'] == MENU:
screen.clear() #clears previous screen on key press and updates display based on pos
processmenu(screen, menu['options'][getin], menu, status_bottom) # display the submenu, and make sure the status is persistent
screen.clear() #clears previous screen on key press and updates display based on pos
elif menu['options'][getin]['type'] == EXITMENU:
exitmenu = True
评论列表
文章目录