pick (original) (raw)
Project description
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 continuingscreen
: (optional), if you are usingpick
within an existing curses application set this to your existingscreen
object. It is assumed this has initialised in the standard way (e.g. viacurses.wrapper()
, orcurses.noecho(); curses.cbreak(); screen.kepad(True)
)position
: (optional), if you are usingpick
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: A fork of pick
to select tree data.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pick-2.4.0.tar.gz
.
File metadata
- Download URL: pick-2.4.0.tar.gz
- Upload date: Sep 15, 2024
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Hashes for pick-2.4.0.tar.gz | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | 71f1b1b5d83652f87652fea5f51a3ba0b3388a71718cdcf8c6bc1326f85ae0b9 | | | MD5 | bb7b40d9a0d30d00598300315e033934 | | | BLAKE2b-256 | dff5980b90af3fd82d18adaa3a1249037d3b1f95e201d640e17a7c5ce6188f45 | |
See more details on using hashes here.
File details
Details for the file pick-2.4.0-py3-none-any.whl
.
File metadata
- Download URL: pick-2.4.0-py3-none-any.whl
- Upload date: Sep 15, 2024
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Hashes for pick-2.4.0-py3-none-any.whl | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | 2b07be18d16d655c7f491e1ecca7a29de3be85e1e000c8d46193672f14faa203 | | | MD5 | 6637bb462994c1fa31146c60e873b177 | | | BLAKE2b-256 | 1195c1ed539b784246182fd04a3fdee6ba473518e658c84d776caa714904d0f9 | |