Pick an option in the terminal with a simple GUI
Project description
pick
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)
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
pick-2.3.2.tar.gz
(4.9 kB
view details)
Built Distribution
pick-2.3.2-py3-none-any.whl
(5.3 kB
view details)
File details
Details for the file pick-2.3.2.tar.gz
.
File metadata
- Download URL: pick-2.3.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91bfa8c17dada639cf793cc4270db39fef8dc2d0c9c8a6be2f3d4d0d9ee58456 |
|
MD5 | 22f3178cf02f759e69dc403d2eba4267 |
|
BLAKE2b-256 | d805ce0020f8586f3e2f7e341ecbc28374866e149af3ad4de5831922a4d03dbe |
File details
Details for the file pick-2.3.2-py3-none-any.whl
.
File metadata
- Download URL: pick-2.3.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78006b6c6b16f80921fe3e66c9730b3fa75b2732d464a9fcd4cab5a4ac75a42d |
|
MD5 | 499e45cbb6fbf5daed2235a99c9ce364 |
|
BLAKE2b-256 | 4d5fe0730cefe5efd21fd3d4ba6e64c75329eaab4d490d3f2e22c230593b5bbc |