Skip to main content

Pick an option in the terminal with a simple GUI

Project description

pick

image PyPI PyPI

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 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)

Community Projects

pickpack: A fork of pick to select tree data.

Project details


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.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pick-2.3.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pick-2.3.1.tar.gz.

File metadata

  • Download URL: pick-2.3.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/21.6.0

File hashes

Hashes for pick-2.3.1.tar.gz
Algorithm Hash digest
SHA256 42da3e6b3603ee0b78956a40d3005b1c871190e08ab4c38bdef11a8c27588ffa
MD5 b0ef2c63b603d2063e425e53b8a1f7fc
BLAKE2b-256 9dbd43ac77befd5725d835d5154da3e181f973841601b2d36001bb6caa82b8a3

See more details on using hashes here.

File details

Details for the file pick-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: pick-2.3.1-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

Hashes for pick-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5108c666f9d2075510f1164dfeb3498024ea3b5893fc40b8df49522a1b7d7c0b
MD5 f612a9388b050fc54cb73d8721575107
BLAKE2b-256 08a3ab9d61acedeb16501b113b1dd7ff3ac93537e61d3bb9e2c6814ec75fb11e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page