Pick an option in the terminal with a simple GUI
Project description
pick
pick is a small python library to help you create curses based interactive selection list in the terminal.
Basic | Multiselect |
---|---|
Installation
$ pip install pick
Usage
pick comes with a simple api:
>>> from pick import pick
>>> title = 'Please choose your favorite programming language: '
>>> options = ['Java', 'JavaScript', 'Python', 'PHP', 'C++', 'Erlang', 'Haskell']
>>> option, index = pick(options, title)
>>> print(option)
>>> print(index)
outputs:
>>> C++
>>> 4
pick multiselect example:
>>> from pick import pick
>>> title = 'Please choose your favorite programming language (press SPACE to mark, ENTER to continue): '
>>> options = ['Java', 'JavaScript', 'Python', 'PHP', 'C++', 'Erlang', 'Haskell']
>>> selected = pick(options, title, multiselect=True, min_selection_count=1)
>>> print(selected)
outputs:
>>> [('Java', 0), ('C++', 4)]
Options
options
: a list of options to choose fromtitle
: (optional) a title above options listindicator
: (optional) custom the selection indicator, defaults to*
default_index
: (optional) set this if the default selected option is not the first onemultiselect
: (optional), if set to True its possible to select multiple items by hitting SPACEmin_selection_count
: (optional) for multi select feature to dictate a minimum of selected items before continuing
Community Projects
pickpack: A fork of pick
to select tree data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pick-2.0.0.tar.gz
(4.7 kB
view details)
Built Distribution
pick-2.0.0-py3-none-any.whl
(4.7 kB
view details)
File details
Details for the file pick-2.0.0.tar.gz
.
File metadata
- Download URL: pick-2.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.0 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74b78edf05204eb17c0c0739dc809b2f52079c256fc8229047670823022cc586 |
|
MD5 | dd3ab948885f3183eac53c0c5b31841d |
|
BLAKE2b-256 | d858f049f5b2d44d0215174db10b00823f7844a09e762a9cfab43452cf07957f |
File details
Details for the file pick-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: pick-2.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.0 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee76e0e50a45d02863d7bd36bc836b4320e6a0991bdb9916cf866fe36b610bd |
|
MD5 | 4a16b9eb4da50ea164b6bfb2a06b54b5 |
|
BLAKE2b-256 | f39660e64b442eb0ed7084c54a8b38bd70c354c92ae47ae30d095806f2f19248 |