{ "info": { "author": "Rene Tanczos", "author_email": "gravmatt@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Terminals" ], "description": "py-term\n=======\n\nPython module to style terminal output, moving and positioning the\ncursor.\n\n**Python 2 and 3 compatible**\n\n.. figure:: pyterm.jpg\n :alt: See? amazing!\n\n alt text\n\nInstallation\n------------\n\nInstall through **pip**.\n\n::\n\n $ pip install py-term\n\nor get from source\n\n::\n\n $ git clone https://github.com/gravmatt/py-term.git\n $ cd py-term\n $ python setup.py install\n\nImport module\n-------------\n\nImport the module into your python project.\n\n::\n\n import term\n\nUsage\n-----\n\n::\n\n term.write('Hello, ')\n term.write('Python!')\n\n > Hello, Python!\n\n term.writeLine('Hello')\n term.writeLine('Python!')\n\n > Hello\n > Python!\n\nStyle output\n------------\n\nThe first argument is the text output and all following arguments are\nfor styling.\n\n::\n\n term.writeLine(text, *style)\n\n Or\n\n text = term.format(text, *style)\n term.writeLine(text)\n\nUsage\n~~~~~\n\n::\n\n term.writeLine('Hello, Python!')\n\n term.writeLine('This text line will be green', term.green)\n\n term.writeLine('Reverse the green color', term.green, term.reverse)\n\nOr\n\n::\n\n ouput = term.format('Hello, ', term.green) + term.format('Python!', term.blue, term.bold)\n\n term.writeLine(output)\n\n term.write(term.format('All in one line', term.reverse))\n\nText align\n^^^^^^^^^^\n\n**Center align**\n\n::\n\n # term.center(text)\n\n term.writeLine(term.center('Super Python!'))\n\n**Right align**\n\n::\n\n # term.right(text)\n\n term.writeLine(term.right('Rene Tanczos (@gravmatt)'))\n\nStyle attributes\n''''''''''''''''\n\n+-------------------+----------------------------------------+\n| Code | Description |\n+===================+========================================+\n| term.off | All attributes off |\n+-------------------+----------------------------------------+\n| term.bold | Bold |\n+-------------------+----------------------------------------+\n| term.dim | Dim |\n+-------------------+----------------------------------------+\n| term.underscore | Underscore (monochrome display only) |\n+-------------------+----------------------------------------+\n| term.blink | Blink |\n+-------------------+----------------------------------------+\n| term.reverse | Reverse |\n+-------------------+----------------------------------------+\n| term.hide | Hide |\n+-------------------+----------------------------------------+\n\nText color\n''''''''''\n\n+----------------+-----------+\n| Code | Color |\n+================+===========+\n| term.black | Black |\n+----------------+-----------+\n| term.red | Red |\n+----------------+-----------+\n| term.green | Green |\n+----------------+-----------+\n| term.yellow | Yellow |\n+----------------+-----------+\n| term.blue | Blue |\n+----------------+-----------+\n| term.magenta | Magenta |\n+----------------+-----------+\n| term.cyan | Cyan |\n+----------------+-----------+\n| term.white | White |\n+----------------+-----------+\n\nBackground color\n''''''''''''''''\n\n+------------------+-----------+\n| Code | Color |\n+==================+===========+\n| term.bgblack | Black |\n+------------------+-----------+\n| term.bgred | Red |\n+------------------+-----------+\n| term.bggreen | Green |\n+------------------+-----------+\n| term.bgyellow | Yellow |\n+------------------+-----------+\n| term.bgblue | Blue |\n+------------------+-----------+\n| term.bgMagenta | Magenta |\n+------------------+-----------+\n| term.bgcyan | Cyan |\n+------------------+-----------+\n| term.bgwhite | White |\n+------------------+-----------+\n\nRemove style attributes\n-----------------------\n\nRemoves style characters.\n\n(Good to call before you count a string)\n\n::\n\n term.strip(formatted_text)\n\n hello = term.red + 'hello, world' + term.off\n print hello\n # '\\x1b[31mhello, world\\x1b[0m\\x1b[27m'\n\n print term.strip(hello)\n # hello, world\n\nHighlighting text\n-----------------\n\nSimple highlighting of unformatted text strings\n\n::\n\n def callback(matching_text):\n return term.blue + matching_text + term.off\n\n output, match_count, array_of_positions = term.highlight(regex_pattern, text, callback)\n\nReturn a tuple.\n\noutput (index 0) = formatted text output\n\nmatch\\_count (index 1) = match count of the pattern\n\narray\\_of\\_positions (index 2) = array of tuples with start and stop\npoints of the matches [(4, 6), (9, 11), ..]\n\nSet title\n---------\n\n::\n\n term.setTitle('Hello Terminal')\n\n # or clear it\n\n term.clearTitle()\n\nSet tab name\n------------\n\n::\n\n term.setTab('Hello Tab')\n\n # or clear it\n\n term.clearTab()\n\nCursor position\n---------------\n\nMove the cursor to a specific position.\n\n::\n\n term.pos(line, column)\n\n term.pos(2, 15)\n\nGet the size of the terminal (lines and columns)\n\n::\n\n (30, 100) = term.getSize()\n\n # (lines, colums) = term.getSize()\n\nMove the cursor to the home position (1, 1).\n\n::\n\n term.homePos()\n\nMoves the current cursor position up, down, left or right by the\nspecified value.\n\n::\n\n term.up(value=1)\n term.down(value=1)\n term.left(value=1)\n term.right(value=1)\n\nSaves the current cursor position.\n\n::\n\n term.saveCursor()\n\nRestore the previously stored cursor position.\n\n::\n\n term.restoreCursor()\n\nClear the terminal screen.\n\n::\n\n term.clear()\n\nClear the entire line on the current cursor position.\n\n::\n\n term.clearLine()\n\nClear line from the current cursor position to the end.\n\n::\n\n term.clearLineFromPos()\n\nClear line from begin to current cursor position.\n\n::\n\n term.clearLineToPos()\n\nLicence\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2015-2016 Ren\u00e9 Tanczos\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gravmatt/py-term", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py-term", "package_url": "https://pypi.org/project/py-term/", "platform": "MacOSX,UNIX/Linux", "project_url": "https://pypi.org/project/py-term/", "project_urls": { "Homepage": "https://github.com/gravmatt/py-term" }, "release_url": "https://pypi.org/project/py-term/0.6/", "requires_dist": null, "requires_python": "", "summary": "Python module to style terminal output, moving and positioning the cursor.", "version": "0.6" }, "last_serial": 2002251, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "652b359a63984b725588c65615867a5c", "sha256": "0fa7a75e0e55224b416ede3c3b4d2f91576f63cf35d4c08b8af1ae2c89e3d9d1" }, "downloads": -1, "filename": "py-term-0.2.tar.gz", "has_sig": false, "md5_digest": "652b359a63984b725588c65615867a5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4342, "upload_time": "2016-02-25T16:12:32", "url": "https://files.pythonhosted.org/packages/97/39/e69c28a2213c39bcfaffb07237fbf4b37212f9bf48ba6f1e2eb0880ffe5b/py-term-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "96f5d86caf2f2e5ca6252b08ab19c43f", "sha256": "f856076ef134bf943b93538fe8bcd66ecbeefea229823e40b975d6eafd12d6ef" }, "downloads": -1, "filename": "py-term-0.3.tar.gz", "has_sig": false, "md5_digest": "96f5d86caf2f2e5ca6252b08ab19c43f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4655, "upload_time": "2016-03-01T20:15:36", "url": "https://files.pythonhosted.org/packages/d0/71/2993ef896b6a8b7f17b5938f3f050c976e56dcc3d6b9d8005487c3c0125b/py-term-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "dc447023aff86e5e90213bfeb8f44345", "sha256": "ee19123b7570e3f030db697abff9426f4a828e74eed9327570ee1aa331fe3c35" }, "downloads": -1, "filename": "py-term-0.4.tar.gz", "has_sig": false, "md5_digest": "dc447023aff86e5e90213bfeb8f44345", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5028, "upload_time": "2016-03-02T10:30:17", "url": "https://files.pythonhosted.org/packages/31/6e/0a89174a6d590a18a2482d1fe4fbe7f0655208f8d2348ec0e10067c5cc2b/py-term-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "826441a7286626368be3a757b232737a", "sha256": "037b56b5de9efb5117e59e7c312f730aed9cd7a728c1ecaede1b1abd0cd74309" }, "downloads": -1, "filename": "py-term-0.5.tar.gz", "has_sig": false, "md5_digest": "826441a7286626368be3a757b232737a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5222, "upload_time": "2016-03-05T21:06:04", "url": "https://files.pythonhosted.org/packages/79/b5/1f9e656b5e11ac5a2c4aa61cd422f05009b7c1f1fb0d68ea6f59297bec25/py-term-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "7a33cf4f1b807a87b7b5c2044231b1fa", "sha256": "f1e9906d88dcf6e53c39632e43f08da6ce179d5ef21826c0deec7d477dfd6b86" }, "downloads": -1, "filename": "py-term-0.6.tar.gz", "has_sig": false, "md5_digest": "7a33cf4f1b807a87b7b5c2044231b1fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5437, "upload_time": "2016-03-11T22:32:03", "url": "https://files.pythonhosted.org/packages/91/e8/c4f9518e8451e132050e19eb9b0e88fec829fb10ba91e5dd1df22a21e739/py-term-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a33cf4f1b807a87b7b5c2044231b1fa", "sha256": "f1e9906d88dcf6e53c39632e43f08da6ce179d5ef21826c0deec7d477dfd6b86" }, "downloads": -1, "filename": "py-term-0.6.tar.gz", "has_sig": false, "md5_digest": "7a33cf4f1b807a87b7b5c2044231b1fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5437, "upload_time": "2016-03-11T22:32:03", "url": "https://files.pythonhosted.org/packages/91/e8/c4f9518e8451e132050e19eb9b0e88fec829fb10ba91e5dd1df22a21e739/py-term-0.6.tar.gz" } ] }