Pick an option in the terminal with a simple GUI
Project description
pick
pick is a small python library to help you create interactive selection list in the terminal.
| Basic | Multiselect |
|---|---|
Installation
$ pip install pick
Optional: blessed backend
pick uses the curses backend by default. If you prefer using
blessed, install the optional extra:
$ pip install "pick[blessed]"
Then pass backend="blessed" to 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 usingpickwithin an existing curses application set this to your existingscreenobject. 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 usingpickwithin 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.backend: (optional), the rendering backend to use. Accepts"curses"(default),"blessed"(requirespip install pick[blessed]), or a customBackendinstance.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pick-2.6.0.tar.gz.
File metadata
- Download URL: pick-2.6.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f24434a845ae9265ebf7657fc224b9a203ac75aa576b568e061484a72e27be82
|
|
| MD5 |
28914525854d8efa466f7ff2f15066ba
|
|
| BLAKE2b-256 |
b6f9450cc44b21190d99b86df3e59f7573d85f3ef2c4f7670ce4f65cb2def3b4
|
File details
Details for the file pick-2.6.0-py3-none-any.whl.
File metadata
- Download URL: pick-2.6.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2acd5cad09be96398fba3b8be89454929de7b05362e01c69d94a05801820871f
|
|
| MD5 |
1fa0400de790baa781803a81705bed38
|
|
| BLAKE2b-256 |
a593704982e09f3481d2055cf8ef7372445dc8ea6c883daf60f0816deb9e362c
|