Display a buttonbox with the specified choices.
    Return the index of the choice selected.
167111
def indexbox(msg="Shall I continue?"
    , title=" "
    , choices=("Yes","No")
    , image=None
    ):
    
    reply = buttonbox(msg=msg, choices=choices, title=title, image=image)
    index = -1
    for choice in choices:
        index = index + 1
        if reply == choice: return index
    raise AssertionError(
        "There is a program logic error in the EasyGui code for indexbox.")
922008
def choose(self, prompt, items, default=None):
        
        if default is not None and (default >= len(items) or default < 0):
            raise IndexError
        prompt = prompt if prompt is not None else "Choose from following:"
        self.show(prompt + '\n')
        self.show("\n".join(number(items)))  # show the items
        prompt = "Enter number of chosen item"
        prompt += " [{0}]: ".format(default) if default is not None else ': '
        return items[self.input(
            curry(filter_int, default=default, start=0, stop=len(items)),
            prompt
        )]
601010
public T selected()
	{
		return selectedIndex < 0 || selectedIndex >= options().size() ? null : options().get(selectedIndex);
	}
476685
def _convert_choices(self, choices):
        """"""

        final_choices = []
        for choice in choices:

            if isinstance(choice, ChoiceEntry):
                final_choices.append(choice)
                continue

            original_choice = choice
            choice = list(choice)
            length = len(choice)

            assert 2 <= length <= 4, 'Invalid number of entries in %s' % (original_choice,)

            final_choice = []

            # do we have attributes?
            if length > 2 and isinstance(choice[-1], Mapping):
                final_choice.append(choice.pop())
            elif length == 4:
                attributes = choice.pop()
                assert attributes is None or isinstance(attributes, Mapping), 'Last argument must be a dict-like object in %s' % (original_choice,)
                if attributes:
                    final_choice.append(attributes)

            # the constant
            final_choice.insert(0, choice.pop(0))

            # the db value
            final_choice.insert(1, choice.pop(0))

            if len(choice):
                # we were given a display value
                final_choice.insert(2, choice.pop(0))
            else:
                # no display value, we compute it from the constant
                final_choice.insert(2, self.display_transform(final_choice[0]))

            final_choices.append(final_choice)

        return super(AutoDisplayChoices, self)._convert_choices(final_choices)
822793
def get_choice(cls, value):
        
        attribute_for_value = cls.attributes[value]
        return cls._fields[attribute_for_value]
999255
def get_choice_href(self):
        
        if 'choiceInfo' not in self.dto[self.name]:
            raise GPException('not a choice parameter')

        return self.dto[self.name]['choiceInfo']['href']
1019971
function _keySelect() {
            var filteredChoices;

            if (lxSelect.choicesViewMode === 'panes') {
                filteredChoices = lxSelect.panes[(lxSelect.panes.length - 1)];
                if (!lxSelect.isLeaf(filteredChoices[lxSelect.activeChoiceIndex])) {
                    return;
                }
            } else {
                filteredChoices = $filter('filterChoices')(lxSelect.choices, lxSelect.filter, lxSelect.filterModel);
            }

            if (filteredChoices.length && filteredChoices[lxSelect.activeChoiceIndex]) {
                lxSelect.toggleChoice(filteredChoices[lxSelect.activeChoiceIndex]);
            } else if (lxSelect.filterModel && lxSelect.allowNewValue) {
                if (angular.isArray(getSelectedModel())) {
                    var value = angular.isFunction(lxSelect.newValueTransform) ? lxSelect.newValueTransform(lxSelect.filterModel) : lxSelect.filterModel;
                    var identical = getSelectedModel().some(function (item) {
                        return angular.equals(item, value);
                    });

                    if (!identical) {
                        lxSelect.getSelectedModel().push(value);
                    }
                }

                lxSelect.filterModel = undefined;

                LxDropdownService.close('dropdown-' + lxSelect.uuid);
            }
        }
470435
String getOption(String[] options, int index) {
        if ((options != null) && (options.length > index)) {
            return options[index];
        }
        return null;
    }
1245841
def find_selected(self, event):
        ''''''
        for m in self.items:
            ret = m.find_selected(event)
            if ret is not None:
                return ret
        return None
977917
def choicebox(message='Pick something.', title='', choices=['program logic error - no choices specified']):
    
    return psidialogs.choice(message=message, title=title, choices=choices)
952202
def boolbox(msg="Shall I continue?"
    , title=" "
    , choices=("Yes","No")
    , image=None
    ):
    
    reply = buttonbox(msg=msg, choices=choices, title=title, image=image)
    if reply == choices[0]: return 1
    else: return 0
710138
def get(self):
        """"""
        return {k:v for k,v in list(self.options.items()) if k in self._allowed_layout}
173087
@ApiModelProperty(hidden=true)
    public static Display getDisplay(String option) {
        if ("Optional".equals(option))
            return Display.Optional;
        else if ("Required".equals(option))
            return Display.Required;
        else if ("Read Only".equals(option))
            return Display.ReadOnly;
        else if ("Hidden".equals(option))
            return Display.Hidden;
        else
            return null;
    }
171001
function choiceListener(index) {
  return function (event) {
    event.preventDefault();
    if (choicesAnimating) return;
    clearChoiceListeners();
    story.ChooseChoiceIndex(index);
    saveGame(index);
    clearOldChoices().then(() => progressGame());
  }
}
18599
def get_select_options(self):
        
        if self.filter_choices:
            return [choice[:4] for choice in self.filter_choices
                    # Display it If the fifth element is True or does not exist
                    if len(choice) < 5 or choice[4]]
436048
def get_choice(prompt, choices):
    
    print()
    checker = []
    for offset, choice in enumerate(choices):
        number = offset + 1
        print("\t{}): '{}'\n".format(number, choice))
        checker.append(str(number))

    response = get_input(prompt, tuple(checker) + ('',))
    if not response:
        print("Exiting...")
        exit()

    offset = int(response) - 1
    selected = choices[offset]

    return selected
69488
def _choose_what_to_display(self, force_refresh=False):
        
        for _ in range(len(self.available_combinations)):
            if (
                self.displayed is None
                and self.available_combinations[0] == self.active_layout
            ):
                self.displayed = self.available_combinations[0]
                break
            else:
                if self.displayed == self.available_combinations[0]:
                    break
                else:
                    self.available_combinations.rotate(1)
        else:
            if force_refresh:
                self.displayed = self.available_combinations[0]
            else:
                self.py3.log('xrandr error="displayed combination is not available"')