Name | pick JSON |
Version |
2.4.0
JSON |
| download |
home_page | https://github.com/aisk/pick |
Summary | Pick an option in the terminal with a simple GUI |
upload_time | 2024-09-15 14:04:29 |
maintainer | None |
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/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/aisk/pick",
"name": "pick",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "terminal, gui",
"author": "wong2",
"author_email": "wonderfuly@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/df/f5/980b90af3fd82d18adaa3a1249037d3b1f95e201d640e17a7c5ce6188f45/pick-2.4.0.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\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pick an option in the terminal with a simple GUI",
"version": "2.4.0",
"project_urls": {
"Homepage": "https://github.com/aisk/pick",
"Repository": "https://github.com/aisk/pick"
},
"split_keywords": [
"terminal",
" gui"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1195c1ed539b784246182fd04a3fdee6ba473518e658c84d776caa714904d0f9",
"md5": "6637bb462994c1fa31146c60e873b177",
"sha256": "2b07be18d16d655c7f491e1ecca7a29de3be85e1e000c8d46193672f14faa203"
},
"downloads": -1,
"filename": "pick-2.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6637bb462994c1fa31146c60e873b177",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5515,
"upload_time": "2024-09-15T14:04:28",
"upload_time_iso_8601": "2024-09-15T14:04:28.245713Z",
"url": "https://files.pythonhosted.org/packages/11/95/c1ed539b784246182fd04a3fdee6ba473518e658c84d776caa714904d0f9/pick-2.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dff5980b90af3fd82d18adaa3a1249037d3b1f95e201d640e17a7c5ce6188f45",
"md5": "bb7b40d9a0d30d00598300315e033934",
"sha256": "71f1b1b5d83652f87652fea5f51a3ba0b3388a71718cdcf8c6bc1326f85ae0b9"
},
"downloads": -1,
"filename": "pick-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "bb7b40d9a0d30d00598300315e033934",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5085,
"upload_time": "2024-09-15T14:04:29",
"upload_time_iso_8601": "2024-09-15T14:04:29.445634Z",
"url": "https://files.pythonhosted.org/packages/df/f5/980b90af3fd82d18adaa3a1249037d3b1f95e201d640e17a7c5ce6188f45/pick-2.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-15 14:04:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aisk",
"github_project": "pick",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pick"
}