def main_menu(menu_list, status): menu = SelectionMenu(menu_list, "Meal Planning with Mary Poppins", prologue_text=status) menu.show() menu.join() selection = menu.selected_option return selection
def test_select(self): selection_menu = SelectionMenu(strings=["a", "b", "c"], title="Select a letter") selection_menu.start() selection_menu.wait_for_start(timeout=10) selection_menu.go_down() selection_menu.select() selection_menu.join(timeout=10) self.assertFalse(selection_menu.is_alive()) self.assertEqual(selection_menu.selected_option, 1)
def show_Contents(lstContents): lst_ContForm = [] for cnt in lstContents.contentList: lst_ContForm.append(cnt.getListItem()) subTitle = '{0:<41} {1:<23} {2:<2}'.format(" Name", "Author", "In") menu = SelectionMenu(lst_ContForm, "Digital Library Contents", subTitle, show_exit_option=False) menu.show() menu.join() return menu.selected_option
def main(): if len(argv) < 2: menu = SelectionMenu(list(tool_dict.keys()), "What type of mechanism are you characterizing?") menu.show() menu.join() mech_type = list(tool_dict.keys())[menu.selected_option] menu = SelectionMenu(list(list(tool_dict.values())[0].keys()), "What tool do you want to use?") menu.show() menu.join() tool_type = list(list( tool_dict.values())[0].keys())[menu.selected_option] tool_dict[mech_type][tool_type](None) else: parser = argparse.ArgumentParser( description="RobotPy characterization tools CLI") parser.add_argument( "mech_type", choices=list(tool_dict.keys()), help="Mechanism type being characterized", ) parser.add_argument( "tool_type", choices=list(list(tool_dict.values())[0].keys()), help= "Create new project, start data recorder/logger, or start data analyzer", ) parser.add_argument( "project_directory", help= "Location for the project directory (if creating a new project)", nargs="?", default=None, ) argcomplete.autocomplete(parser) args = parser.parse_args() tool_dict[args.mech_type][args.tool_type](args.project_directory)
.set_subtitle_align('center') \ .set_left_margin(4) \ .set_right_margin(4) \ .show_header_bottom_border(True) #################################################################################################################### menu = SelectionMenu([ "Start the brain and use algorithmic learning", "Start the brain and use machine learning" ], title="Welcome to the Brain of Pepper", subtitle="The ip is: " + get_ip(), show_exit_option=False, formatter=menu_format) menu.show() menu.join() menuvariable = menu.selected_option print("\n Waiting for the robot...") with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() conn, addr = s.accept() with conn: #print('Connected by', addr) menu = SelectionMenu([ "I want to communicate orally with the robot", "I want to type my answers on the robot"