Skip to main content

curses based interactive value input

Project description

Interactive input

Useage

install package

Install by pip

pip install interactive_input

Cording

  1. Import and instantiate.
  2. regist keys,messages,hook functions
  3. Call Ask(), it return key-value pair with value by user input.
  4. If call Ask() more than once, object save previous input. so it can request only the increased.
  5. You can overwrite value data with overwrite=True option.
import interactive_input as iin

def main():
    var iinObj = iin.Object()
    iinObj.AddQ("key1")
    iinObj.AddQ("key2", message="Please Input", hook=base64enc)

    # this will delete value of "key1". (not delete key)
    iinObj.AddQ("key1", message="Overwrited", overwrite=True)

def base64enc(v: str) -> str:
    # you can something for user input. (e.g. hashing, encoding)
    return "encoded: " + v

Run and Using

Ask() will present input UI like below.

Overwrited
Key1: _
Please Input
Key2: 

Can move allow-key or jkl. h function as [BACKSPACE]. (can use BS normally as well) [ENTER] can move next value. If hit [ENTER] with last line, Decide values and go next step.

Bug

  • Can't use non ascii character. it will broken data.
  • Not support very narrow console.

LICENCE

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interactive_input-0.6.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file interactive_input-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: interactive_input-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for interactive_input-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b2d932b6f251b66cf82b2fe51d7ac303491bfcc7d997a6ecc75942ca4c16e7
MD5 159208ee1ba017a8b1188e3b5fea6963
BLAKE2b-256 a67c9ac5847605ddb87cb594e7e6a0a6a471d75a422f24a05f9c6c5f36ed0ae3

See more details on using hashes here.

Supported by

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