(options, auto=False)
return multiple_choice
Override of the select_options function to allow both text and integer input for multiple choice.
Override of the select_options function to allow both text and integer input for multiple choice.
Override of the select_options function to allow both text and integer input for multiple choice .
def multi_select(options, auto=False):
    """Override of the select_options function to allow both text and integer input for multiple choice."""

    if not auto:

        #Display the options
        choice = select_options(options, multiple_choice=True, _show_choice_only='input_override')

        #Read the integer selections
        int_choice = value_select(choice, [option[1] for option in options], start=1, revert_to_default=True)
        for i, value in enumerate(int_choice):
            if value:
                choice = choice.replace(str(i+1), '')
        multiple_choice = set(options[i][0] for i, value in enumerate(int_choice) if value)

        #Parse the text input
        multiple_choice.update(i.strip() for i in choice.replace(' ', ',').split(','))
        try:
            multiple_choice.remove('')
        except KeyError:
            pass

    #Get random selection
    if auto or not multiple_choice:
        random_choice = select_options(options, multiple_choice=True, auto_choose_on_fail=True, _selection='', _show_choice_only=False)
        multiple_choice = set(options[i][0] for i, value in enumerate(random_choice) if value)
    
    return multiple_choice
def multi_select ( options , auto = False ) : if not auto : #Display the options choice = select_options ( options , multiple_choice = True , _show_choice_only = 'input_override' ) #Read the integer selections int_choice = value_select ( choice , [ option [ 1 ] for option in options ] , start = 1 , revert_to_default = True ) for i , value in enumerate ( int_choice ) : if value : choice = choice . replace ( str ( i + 1 ) , '' ) multiple_choice = set ( options [ i ] [ 0 ] for i , value in enumerate ( int_choice ) if value ) #Parse the text input multiple_choice . update ( i . strip ( ) for i in choice . replace ( ' ' , ',' ) . split ( ',' ) ) try : multiple_choice . remove ( '' ) except KeyError : pass #Get random selection if auto or not multiple_choice : random_choice = select_options ( options , multiple_choice = True , auto_choose_on_fail = True , _selection = '' , _show_choice_only = False ) multiple_choice = set ( options [ i ] [ 0 ] for i , value in enumerate ( random_choice ) if value ) return multiple_choice