File: checkbox_toppings.py

package info (click to toggle)
python-questionary 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: python: 3,917; makefile: 66
file content (17 lines) | stat: -rw-r--r-- 492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import questionary
from examples import custom_style_dope

if __name__ == "__main__":
    toppings = (
        questionary.checkbox(
            "Select toppings",
            choices=["foo", "bar", "bazz"],
            validate=lambda a: (
                True if len(a) > 0 else "You must select at least one topping"
            ),
            style=custom_style_dope,
        ).ask()
        or []
    )

    print(f"Alright let's go mixing some {' and '.join(toppings)} 🤷‍♂️.")