[ACCEPTED]-Python Command Line Checkboxes-command-line-interface
Accepted answer
Have a look at the python-inquirer package.
To make a checkbox 1 list you can do something like this:
import inquirer
questions = [inquirer.Checkbox(
'interests',
message="What are you interested in?",
choices=['Computers', 'Books', 'Science', 'Nature', 'Fantasy', 'History'],
)]
answers = inquirer.prompt(questions) # returns a dict
print(answers['interests'])
There is beaupy, which allows you to do something 2 like this:
from beaupy import select_multiple
pizza_toppings = select_mutliple(['pineapple', 'olives', 'anchovies', 'mozzarella', 'parma ham']
maximal_count=3,
minimal_count=1)
Note: I am a maintainer of beaupy
and 1 this is nothing short of shameless self-promotion.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.