[ACCEPTED]-Python Command Line Checkboxes-command-line-interface

Accepted answer
Score: 10

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']) 
Score: 0

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.

More Related questions