if edit_mode: print(Utils.green_bright("EDIT"), end='') else: print(Utils.red_bright('DELETE'), end='') print( f' | Board: {game.current_board().name} - {game.current_board().size} | Cursor @ {game.player.pos}' ) game.display_board() if len(object_history) > 10: del (object_history[0]) if current_menu == 'main': print('Item history:') cnt = 0 for o in object_history: print(f"{cnt}: {o.model}", end=' ') cnt += 1 print('') print(f'Current item: {current_object.model}') if not (current_menu == 'main' and menu_mode == 'hidden'): game.display_menu(current_menu, Constants.ORIENTATION_VERTICAL, 15) for m in dbg_messages: Utils.debug(m) for m in info_messages: Utils.info(m) for m in warn_messages: Utils.warn(m) if current_menu == 'boards_list': key = input('Enter your choice (and hit ENTER): ') else: key = Utils.get_key()
current_menu = "main_menu" # Now let's make a loop to dynamically navigate in the menu key = None while True: # clear screen mygame.clear_screen() # First print the message is something is in it the variable if message is not None: print(message) # We don't want to print the message more than once, so we put # the message to None once it's printed. message = None # Now let's display the main_menu mygame.display_menu(current_menu) # Take user input key = input("> ") if key == "1" or key == "2" or key == "j": message = Utils.green_bright(f"Selected menu is: {current_menu}/{key}") elif key == "q": print("Quitting...") break elif key == "h": current_menu = "help_menu" elif key == "b": current_menu = "main_menu" else: message = Utils.red_bright("Invalid menu shortcut.")