Package: cselector
https://github.com/aieater/python_console_selectorcselector (Console Selector)DescriptionConsole selector for python.
This is inspired fromhttps://pypi.org/project/pick/and it wanted to more customize for image previewer in iTerm2(imgcat).Single SelectorTitle hoge hoge.
=>  ItemA
    ItemB
    ItemCMulti SelectorTitle hogehoge
[ ]  Item0
[ ]  Item1
[*]  Item2
[ ]  Item3
[ ]  Item4
[ ]  Item5
[ ]  Item6
[ ]  Item7
[*]  Item8
[ ]  Item9
1 2 3 4 5Binary SelectorDo you do machine learning? (default: yes)[Y/n] > Yes
# TrueFeaturesSingle selector.Multi selector.Binary selector.No dependencies.No clear display.Page navigation.All selector.Image viewer (for private)Installationpip3 install cselectorSingle selectorMove: 'Up', 'Down' keyEnd: 'Return' keyfrom cselector import selector

selected = selector(options=["ItemA","ItemB","ItemC"],title="Title hoge hoge.")
print(selected) # (<Index>,<Option>)Title hoge hoge.
=>  ItemA
    ItemB
    ItemCMulti SelectorPagenation: 'Left', 'Right' keyMove: 'Up', 'Down' keySelect: 'Space' keyEnd: 'Return' keyPreview: '@' keyfrom cselector import multi_selector

options = []
for x in range(47):
    options.append("Item"+str(x))
selected_array = multi_selector(options=options,title="Title hogehoge")
print(selected_array) # [(<Index>,<Option>),(<Index>,<Option>),(<Index>,<Option>)....]Title hogehoge
[ ]  Item0
[ ]  Item1
[*]  Item2
[ ]  Item3
[ ]  Item4
[ ]  Item5
[ ]  Item6
[ ]  Item7
[*]  Item8
[ ]  Item9
1 2 3 4 5Multi Selector - With all selectorfrom cselector import multi_selector

options = []
for x in range(47):
    options.append("Item"+str(x))
selected_array = multi_selector(options=options,title="Title hogehoge",all="All item title")
print(selected_array) # [(<Index>,<Option>),(<Index>,<Option>),(<Index>,<Option>)....]Title hogehoge
[*]  All item title
[*]  Item0
[*]  Item1
[*]  Item2
[*]  Item3
[*]  Item4
[*]  Item5
[*]  Item6
[*]  Item7
[*]  Item8
1 2 3 4 5Multi Selector - Minimum selectionfrom cselector import multi_selector

options = []
for x in range(47):
    options.append("Item"+str(x))
selected_array = multi_selector(options=options,title="Title hogehoge",min_count=2)
print(selected_array) # [(<Index>,<Option>),(<Index>,<Option>),(<Index>,<Option>)....]Multi Selector - Maximum item number of pagefrom cselector import multi_selector

options = []
for x in range(47):
    options.append("Item"+str(x))
selected_array = multi_selector(options=options,title="Title hogehoge",split=20)
print(selected_array) # [(<Index>,<Option>),(<Index>,<Option>),(<Index>,<Option>)....]Multi Selector - With previewer (Required aimage library)Preview: '@' keyimport aimage
import glob
import os
from cselector import multi_selector
options = []
preview = []
for f in glob.glob(os.path.expanduser("~/cg/*.jpg")):
    preview += [aimage.load(f)]
    options += [os.path.basename(f)]
print(options)
selected_array = multi_selector(options=options,title="Title hogehoge",preview=preview,preview_console=True)
print(selected_array) # [(<Index>,<Option>),(<Index>,<Option>),(<Index>,<Option>)....]Binary selector - Yes or Nofrom cselector import yes_or_no
ret = yes_or_no(question="Do you do machine learning?",default="y")
print(ret) # True/FalseSupported OSOSSupportUnixXLinuxXMacOSXXWindowsSupported Python VersionVersionSupportPython2.7Python3.4XPython3.5XPython3.6XPython3.7XPython3.8XPython package dependenciesNo dependenciesVersionLibraryinstallationNoneNoneNoneLicenseThis project is licensed under the MIT License - see theLICENSEfile for details