# pick
[![image](https://github.com/aisk/pick/actions/workflows/ci.yml/badge.svg)](https://github.com/aisk/pick/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/pick.svg)](https://pypi.python.org/pypi/pick)
[![PyPI](https://img.shields.io/pypi/dm/pick)](https://pypi.python.org/pypi/pick)
**pick** is a small python library to help you create curses based
interactive selection list in the terminal.
| Basic | Multiselect |
| :--------------------: | :--------------------------: |
| ![](example/basic.gif) | ![](example/multiselect.gif) |
## 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 from
- `title`: (optional) a title above options list
- `indicator`: (optional) custom the selection indicator, defaults to `*`
- `default_index`: (optional) set this if the default selected option
is not the first one
- `multiselect`: (optional), if set to True its possible to select
multiple items by hitting SPACE
- `min_selection_count`: (optional) for multi select feature to
dictate a minimum of selected items before continuing
- `screen`: (optional), if you are using `pick` within an existing curses application set this to your existing `screen` object. It is assumed this has initialised in the standard way (e.g. via `curses.wrapper()`, or `curses.noecho(); curses.cbreak(); screen.kepad(True)`)
- `position`: (optional), if you are using `pick` within an existing curses application use this to set the first position to write to. e.g., `position=pick.Position(y=1, x=1)`
- `quit_keys`: (optional), if you want to quit early, you can pass a key codes.
If the corresponding key are pressed, it will quit the menu.
## Community Projects
[pickpack](https://github.com/anafvana/pickpack): A fork of `pick` to select tree data.
Raw data
{
"_id": null,
"home_page": "https://github.com/DJStompZone/colorpick",
"name": "colorpick",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "terminal, gui, curses, colorama",
"author": "wong2",
"author_email": "wonderfuly@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d9/4e/7b0db4edb07b3ac93e7ebddd79eeefae0e830d02567d8e46b332784344c6/colorpick-2.4.3.tar.gz",
"platform": null,
"description": "# pick\n\n[![image](https://github.com/aisk/pick/actions/workflows/ci.yml/badge.svg)](https://github.com/aisk/pick/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/pick.svg)](https://pypi.python.org/pypi/pick)\n[![PyPI](https://img.shields.io/pypi/dm/pick)](https://pypi.python.org/pypi/pick)\n\n**pick** is a small python library to help you create curses based\ninteractive selection list in the terminal.\n\n| Basic | Multiselect |\n| :--------------------: | :--------------------------: |\n| ![](example/basic.gif) | ![](example/multiselect.gif) |\n\n## Installation\n\n $ pip install pick\n\n## Usage\n\n**pick** comes with a simple api:\n\n >>> from pick import pick\n\n >>> title = 'Please choose your favorite programming language: '\n >>> options = ['Java', 'JavaScript', 'Python', 'PHP', 'C++', 'Erlang', 'Haskell']\n >>> option, index = pick(options, title)\n >>> print(option)\n >>> print(index)\n\n**outputs**:\n\n >>> C++\n >>> 4\n\n**pick** multiselect example:\n\n >>> from pick import pick\n\n >>> title = 'Please choose your favorite programming language (press SPACE to mark, ENTER to continue): '\n >>> options = ['Java', 'JavaScript', 'Python', 'PHP', 'C++', 'Erlang', 'Haskell']\n >>> selected = pick(options, title, multiselect=True, min_selection_count=1)\n >>> print(selected)\n\n**outputs**:\n\n >>> [('Java', 0), ('C++', 4)]\n\n## Options\n\n- `options`: a list of options to choose from\n- `title`: (optional) a title above options list\n- `indicator`: (optional) custom the selection indicator, defaults to `*`\n- `default_index`: (optional) set this if the default selected option\n is not the first one\n- `multiselect`: (optional), if set to True its possible to select\n multiple items by hitting SPACE\n- `min_selection_count`: (optional) for multi select feature to\n dictate a minimum of selected items before continuing\n- `screen`: (optional), if you are using `pick` within an existing curses application set this to your existing `screen` object. It is assumed this has initialised in the standard way (e.g. via `curses.wrapper()`, or `curses.noecho(); curses.cbreak(); screen.kepad(True)`)\n- `position`: (optional), if you are using `pick` within an existing curses application use this to set the first position to write to. e.g., `position=pick.Position(y=1, x=1)`\n- `quit_keys`: (optional), if you want to quit early, you can pass a key codes.\n If the corresponding key are pressed, it will quit the menu.\n\n## Community Projects\n\n[pickpack](https://github.com/anafvana/pickpack): A fork of `pick` to select tree data.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Create curses-based interactive selection list in the terminal. Now with color!",
"version": "2.4.3",
"project_urls": {
"Homepage": "https://github.com/DJStompZone/colorpick",
"Repository": "https://github.com/DJStompZone/colorpick"
},
"split_keywords": [
"terminal",
" gui",
" curses",
" colorama"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b3b4b8daa318dfc4152970f73b40c6c1f46e82fa9e9618b0964b076847668170",
"md5": "78e28d6ad82aa414e604ec84d1b1f60e",
"sha256": "93873346b2833077b497ddcee7b03a6ff4271fc868f2aff5cf4cab432031d771"
},
"downloads": -1,
"filename": "colorpick-2.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78e28d6ad82aa414e604ec84d1b1f60e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5740,
"upload_time": "2024-08-23T20:25:30",
"upload_time_iso_8601": "2024-08-23T20:25:30.736228Z",
"url": "https://files.pythonhosted.org/packages/b3/b4/b8daa318dfc4152970f73b40c6c1f46e82fa9e9618b0964b076847668170/colorpick-2.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d94e7b0db4edb07b3ac93e7ebddd79eeefae0e830d02567d8e46b332784344c6",
"md5": "483e65daccb7e8c7828cd833501bef17",
"sha256": "def5450a3ae4db7510f2d01377bbb430304f82b5b7af0d8e9b89144f94f28fcf"
},
"downloads": -1,
"filename": "colorpick-2.4.3.tar.gz",
"has_sig": false,
"md5_digest": "483e65daccb7e8c7828cd833501bef17",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5395,
"upload_time": "2024-08-23T20:25:32",
"upload_time_iso_8601": "2024-08-23T20:25:32.237789Z",
"url": "https://files.pythonhosted.org/packages/d9/4e/7b0db4edb07b3ac93e7ebddd79eeefae0e830d02567d8e46b332784344c6/colorpick-2.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-23 20:25:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DJStompZone",
"github_project": "colorpick",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "colorpick"
}