{ "info": { "author": "K.C.Saff", "author_email": "kc@saff.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development", "Topic :: Software Development :: User Interfaces" ], "description": "See it at:\n\n- `pypi`_\n- `GitHub`_\n\n============== =============== ========= ============\nVERSION DOWNLOADS TESTS COVERAGE\n============== =============== ========= ============\n|pip version| |pip downloads| |travis| |coveralls|\n============== =============== ========= ============\n\nLibrary to easily read single chars and key strokes.\n\n\nQuick Start\n===========\n\n.. code:: python\n\n from getkey import getkey, keys\n key = getkey()\n if key == keys.UP:\n ... # Handle the UP key\n elif key == keys.DOWN:\n ... # Handle the DOWN key\n elif key == 'a':\n ... # Handle the `a` key\n elif key == 'Y':\n ... # Handle `shift-y`\n else:\n # Handle other text characters\n buffer += key\n print(buffer)\n\nHistory\n=======\n\n\nThis library seems to have started as a gist by Danny Yoo & made the rounds in\nvarious versions until Miguel \u00c1ngel Garc\u00eda turned it into a portable package\nfor their `python-inquirer`_ project. Then K.C.Saff forked it & smashed it\ninto this new form for their own command line input library.\n\n\nPhilosophy\n==========\n\n\nKeys will be returned as strings representing the received key codes, however\nas some keys may have multiple possible codes on a platform, the key code will\nbe canonicalized so you can test :code:`key == keys.UP` instead of\n:code:`key in keys.UP`. This means non-control keys will be returned just as\nthe text they represent, and you can just as easily test :code:`key == 'a'` to\nsee if the user pressed :code:`a`.\n\nIn addition, by default we will throw :code:`KeyboardInterrupt` for\n:code:`Ctrl-C` which would otherwise be suppressed. However, it is possible\nto disable this if you wish:\n\n.. code:: python\n\n from getkey import plaform\n my_platform = platform(interrupts={})\n my_getkey = my_platform.getkey\n\n\nNow :code:`my_getkey` will be a function returning keys that won't throw on\n:code:`Ctrl-C`. Warning! This may make it difficult to exit a running script.\n\n\nPlans\n=====\n\n\nThis library will not hit 1.0 until we can verify it works correctly with\nunicode & international keyboards. This is not yet tested.\n\n\n\nDocumentation\n=============\n\nInstallation\n------------\n\n::\n\n pip install getkey\n\nThe :code:`getkey` library is compatible with python 2.7, and 3.2+.\n\nUsage\n-----\n\nUsage example:\n\n.. code:: python\n\n from getkey import getkey, keys\n key = getkey()\n if key == keys.UP:\n ... # Handle the UP key\n elif key == keys.DOWN:\n ... # Handle the DOWN key\n ... # Handle all other desired control keys\n else: # Handle text characters\n buffer += key\n print(buffer)\n\n\nPlease consult :code:`tools/keys.txt` for a full list of key names available on\ndifferent platforms, or :code:`tools/controls.txt` for the abridged version\njust containing control (normally non-printing) characters.\n\nAPI\n----\n\nThere is one primary method:\n\n:code:`getkey(blocking=True)`\n/////////////////////////////\n\nReads the next key-stroke from :code:`stdin`, returning it as an string.\n\nA key-stroke can have:\n\n- 1 character for normal keys: 'a', 'z', '9'...\n- 1 character for certain control combinations: '\\x01' as Ctrl-A, for example\n- more for other control keys (system dependent, but with portable names)\n- check :code:`tools/keys.txt` for keys available on different systems.\n\nInterpreting the keycode response is made easier with the :code:`keys` object:\n\n:code:`keys`\n////////////\n\nContains portable names for keys, so that :code:`keys.UP` will mean the up\nkey on both Linux or Windows, even though the actual key codes are\ndifferent.\n\nBecause the list of key names is generated dynamically, please consult\n:code:`tools/keys.txt` for a full list of key names. It is not necessary to\nuse key names for single characters: if the user pushes `a` the key returned\nis very portably just that single character `a` itself.\n\n:code:`keys.name(code)`\n///////////////////////\n\nReturns the canonical name of the key which yields this key code on this\nplatform. One key code may have multiple aliases, but only the canonical\nname will be returned. The canonical names are marked with an\nasterisk in :code:`tools/keys.txt`.\n\n\nOS Support\n----------\n\nThis library has been tested on both Mac & Windows, & the Mac keys should work\nmuch the same on Linux. If planning to use more esoteric control keys,\nplease verify compatibility by checking\n\nHow to contribute\n=================\n\nYou can download the code, make some changes with their tests, and make a\npull-request.\n\nIn order to develop or running the tests, you can do:\n\n1. Clone the repository.\n\n.. code:: bash\n\n git clone https://github.com/kcsaff/getkey.git\n\n2. Create a virtual environment:\n\n.. code:: bash\n\n virtualenv venv\n\n3. Enter in the virtual environment\n\n.. code:: bash\n\n source venv/bin/activate\n\n4. Install dependencies\n\n.. code:: bash\n\n pip install -r requirements.txt -r requirements-dev.txt\n\n5. Run tests\n\n.. code:: bash\n\n make\n\n\nPlease, **Execute the tests before any pull-request**. This will avoid invalid builds.\n\n\nLicense\n=======\n\nCopyright (c) 2014, 2015 Miguel \u00c1ngel Garc\u00eda (`@magmax9`_).\n\nCopyright (c) 2016 K.C.Saff (`@kcsaff`_)\n\nBased on previous work on gist `getch()-like unbuffered character reading from stdin on both Windows and Unix (Python recipe)`_, started by `Danny Yoo`_.\n\nLicensed under `the MIT license`_.\n\n\n.. |travis| image:: https://travis-ci.org/kcsaff/getkey.png\n :target: `Travis`_\n :alt: Travis results\n\n.. |coveralls| image:: https://coveralls.io/repos/kcsaff/getkey/badge.png\n :target: `Coveralls`_\n :alt: Coveralls results_\n\n.. |pip version| image:: https://img.shields.io/pypi/dd/getkey.svg\n :target: https://pypi.python.org/pypi/getkey\n :alt: Latest PyPI version\n\n.. |pip downloads| image:: https://img.shields.io/pypi/v/getkey.svg\n :target: https://pypi.python.org/pypi/getkey\n :alt: Number of PyPI downloads\n\n.. _pypi: https://pypi.python.org/pypi/getkey\n.. _GitHub: https://github.com/kcsaff/getkey\n.. _Travis: https://travis-ci.org/kcsaff/getkey\n.. _Coveralls: https://coveralls.io/r/magmax/python-readchar\n.. _@magmax9: https://twitter.com/magmax9\n.. _@kcsaff: https://twitter.com/kcsaff\n.. _python-inquirer: https://github.com/magmax/python-inquirer\n\n.. _the MIT license: http://opensource.org/licenses/MIT\n.. _getch()-like unbuffered character reading from stdin on both Windows and Unix (Python recipe): http://code.activestate.com/recipes/134892/\n.. _Danny Yoo: http://code.activestate.com/recipes/users/98032/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kcsaff/getkey", "keywords": "stdin,command line", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "getkey", "package_url": "https://pypi.org/project/getkey/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/getkey/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/kcsaff/getkey" }, "release_url": "https://pypi.org/project/getkey/0.6.5/", "requires_dist": null, "requires_python": null, "summary": "Read single characters and key-strokes", "version": "0.6.5" }, "last_serial": 2319875, "releases": { "0.5.0": [], "0.6": [ { "comment_text": "", "digests": { "md5": "b7964a68db90197e5d6cc48de3e34cd5", "sha256": "2337fe2fb239e2263929452ece5c5d43df6a808f43cc79b8734d86fb99b9080b" }, "downloads": -1, "filename": "getkey-0.6.tar.gz", "has_sig": false, "md5_digest": "b7964a68db90197e5d6cc48de3e34cd5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12298, "upload_time": "2016-08-23T22:32:25", "url": "https://files.pythonhosted.org/packages/19/e9/f9990048fffd4468f3af91203e753bd920d51120ba60ea53403b5b9c9a8f/getkey-0.6.tar.gz" } ], "0.6.1": [], "0.6.2": [ { "comment_text": "", "digests": { "md5": "8a1ce4ba30ea3e3022d6eca37ced98ad", "sha256": "2294e9ab88c4ded25cbf046766a2d2de5eefc0c895926ee16c6dc12e56f45620" }, "downloads": -1, "filename": "getkey-0.6.2.tar.gz", "has_sig": false, "md5_digest": "8a1ce4ba30ea3e3022d6eca37ced98ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13737, "upload_time": "2016-09-01T22:09:33", "url": "https://files.pythonhosted.org/packages/80/c8/0d6c68ae029749632e2b392cbdf6b76c0f4548d9388b15acc2be8999ef83/getkey-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "207e22421033a8bfee4e0f880f796adf", "sha256": "370e7987fef14ab6a96c3191a98b0b22ac7911c0b3899ef3506029776a70870f" }, "downloads": -1, "filename": "getkey-0.6.3.tar.gz", "has_sig": false, "md5_digest": "207e22421033a8bfee4e0f880f796adf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13719, "upload_time": "2016-09-01T23:10:39", "url": "https://files.pythonhosted.org/packages/30/42/e69b0afd5cc367c47db52dd33fc85de7938463530fd9d49f5957fde763a5/getkey-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "5a866379fb0e6f2c96ee3555544f0814", "sha256": "213b976d815d59367af76e5885cc3de91a6776ea94dccfe6b412e95a28519ed5" }, "downloads": -1, "filename": "getkey-0.6.4.tar.gz", "has_sig": false, "md5_digest": "5a866379fb0e6f2c96ee3555544f0814", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13758, "upload_time": "2016-09-01T23:38:55", "url": "https://files.pythonhosted.org/packages/66/34/ad24ca45ec1d75126201865adba262926bd541adddf8662329cfd8698adf/getkey-0.6.4.tar.gz" } ], "0.6.5": [ { "comment_text": "", "digests": { "md5": "1a6ef21e97b9eca4f285acd8396566de", "sha256": "68c7c702c3b34deacf427f6c0f1fd66c5c2aa12d7801aa32442fc1a71c8ce059" }, "downloads": -1, "filename": "getkey-0.6.5.tar.gz", "has_sig": false, "md5_digest": "1a6ef21e97b9eca4f285acd8396566de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13757, "upload_time": "2016-09-01T23:42:33", "url": "https://files.pythonhosted.org/packages/74/f2/3312ea94369f410967667eeca61d261cdf3037df6ea827078ac7c5321150/getkey-0.6.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1a6ef21e97b9eca4f285acd8396566de", "sha256": "68c7c702c3b34deacf427f6c0f1fd66c5c2aa12d7801aa32442fc1a71c8ce059" }, "downloads": -1, "filename": "getkey-0.6.5.tar.gz", "has_sig": false, "md5_digest": "1a6ef21e97b9eca4f285acd8396566de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13757, "upload_time": "2016-09-01T23:42:33", "url": "https://files.pythonhosted.org/packages/74/f2/3312ea94369f410967667eeca61d261cdf3037df6ea827078ac7c5321150/getkey-0.6.5.tar.gz" } ] }