Name | pick JSON |
Version |
2.2.0
JSON |
| download |
home_page | https://github.com/wong2/pick |
Summary | Pick an option in the terminal with a simple GUI |
upload_time | 2022-11-21 06:27:36 |
maintainer | |
docs_url | None |
author | wong2 |
requires_python | >=3.7 |
license | MIT |
keywords |
terminal
gui
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pick
[![image](https://github.com/wong2/pick/actions/workflows/ci.yml/badge.svg)](https://github.com/wong2/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)`)
## 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/wong2/pick",
"name": "pick",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "terminal,gui",
"author": "wong2",
"author_email": "wonderfuly@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5f/08/45f5bda20b9ad318c1cbeb911e9995e7357d4ae93cbfaccc8f2e40e96ec4/pick-2.2.0.tar.gz",
"platform": null,
"description": "# pick\n\n[![image](https://github.com/wong2/pick/actions/workflows/ci.yml/badge.svg)](https://github.com/wong2/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\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": "Pick an option in the terminal with a simple GUI",
"version": "2.2.0",
"split_keywords": [
"terminal",
"gui"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "fb385f6ccec50cc1da229ddbc3b36c47",
"sha256": "d301f358ee8eabe501795bb38a5160e05db68c0a89eb7ba38c7b667fc4673c8d"
},
"downloads": -1,
"filename": "pick-2.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb385f6ccec50cc1da229ddbc3b36c47",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4880,
"upload_time": "2022-11-21T06:27:34",
"upload_time_iso_8601": "2022-11-21T06:27:34.256087Z",
"url": "https://files.pythonhosted.org/packages/d6/e8/67bd33eeeb1aad2013fa24b3e94c874a901337b86c52a0ac3764f12a86e1/pick-2.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "211f75b2a915c9d8c435962a28864b9d",
"sha256": "96920ebcfb9b8b6c2e50d9f211a700e5036611904169587a5a9245a645637a0d"
},
"downloads": -1,
"filename": "pick-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "211f75b2a915c9d8c435962a28864b9d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4925,
"upload_time": "2022-11-21T06:27:36",
"upload_time_iso_8601": "2022-11-21T06:27:36.609272Z",
"url": "https://files.pythonhosted.org/packages/5f/08/45f5bda20b9ad318c1cbeb911e9995e7357d4ae93cbfaccc8f2e40e96ec4/pick-2.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-21 06:27:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "wong2",
"github_project": "pick",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pick"
}