Open r3a1d3a1 opened 1 year ago
Some hack for this (works with pick 2.2.0):
import pick
# Example 1: Pre-select 3 options (first, third, sixth)
preselected = [0, 2, 5]
# Example 2: Pre-select all options
# preselected = list(range(len(options)))
__original_post_init__ = pick.Picker.__post_init__
def __hacked_post_init__(self):
__original_post_init__(self)
self.selected_indexes.extend(preselected)
pick.Picker.__post_init__ = __hacked_post_init__
selected = pick.pick(options=options, multiselect=True)
It would be trivial to add the feature to the main code without an ugly hack. @wong2 Do you review and accept pull requests ? I see there are some of them that have never been evaluated...
I can't tell from the README whether it's possible to have a few options selected as the dialog is presented to the user at first. For example, there may be 10 options, 3 of which are selected initially.