cursor


Namecursor JSON
Version 1.3.5 PyPI version JSON
download
home_pagehttps://github.com/GijsTimmers/cursor
SummaryA small Python package to hide or show the terminal cursor
upload_time2022-06-15 12:39:56
maintainer
docs_urlNone
authorGijs Timmers
requires_python
license
keywords cursor terminal hide show
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

![PyPI version](https://badge.fury.io/py/cursor.svg)

# cursor 
A small Python package to hide or show the terminal cursor.
Works on Linux and Windows, on both Python 2 and Python 3.

![demonstration](http://i.imgur.com/2iXviMi.gif)

## Disclaimer
The code is almost entirely a copy of
[James Spencer's](http://stackoverflow.com/u/1375885/) 
[answer on StackOverflow](http://stackoverflow.com/a/10455937/1096437).


## Installation
The preferred way of installing `cursor` is via `pip`.
You can install `pip` with your package manager:

#### On Ubuntu:
    
    sudo apt-get install python-pip
    pip install --user cursor

#### On Arch:
    
    git clone https://aur.archlinux.org/python-cursor.git
    cd python-cursor
    makepkg -si

## Usage

```python
import cursor
cursor.hide() ## Hides the cursor
cursor.show() ## Shows the cursor
```


Note that the cursor will stay hidden until you call `cursor.show()` — 
even after exiting your python script!

Because of that, `pip` will install two scripts, which can be run
from the command line: `cursor_hide` and `cursor_show`.

An alternative is using the `HiddenCursor()` class in conjunction
with Python's `with` statement. This will make sure that the cursor
is shown again after running your code, even if exceptions are
raised:

```python
import cursor
with cursor.HiddenCursor():     ## Cursor will stay hidden
    import time                 ## while code is being executed;
    for a in range(1,100):      ## afterwards it will show up again
        print(a)
        time.sleep(0.05)
    
```

You could also use Python's `atexit` module:

```python
import cursor
import atexit
import time

atexit.register(cursor.show)    ## Make sure cursor.show() is called
                                ## when exiting

cursor.hide()                   ## Hides cursor
for a in range(1,100):
    print(a)
    time.sleep(0.05)
exit()                          ## Cursor will show again
```

## Contributors
[Manraj Singh](https://github.com/ManrajGrover): allowed setting
a customisable stream 

[Alexander Seiler](https://github.com/goggle): packaging for Arch

Patrik Kopkan: packaging for Fedora


## Projects using `cursor`
[`halo`](https://github.com/ManrajGrover/halo): beautiful 
terminal spinners in Python

[`pipenv`](https://github.com/pypa/pipenv): a tool that aims to bring the best of all packaging worlds to the Python world
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/GijsTimmers/cursor",
    "name": "cursor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "cursor,terminal,hide,show",
    "author": "Gijs Timmers",
    "author_email": "timmers.gijs@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/59/1b/ae231e1f9a8e1f970453f92fcb20a3fce87fa38753915477c26bc1655d86/cursor-1.3.5.tar.gz",
    "platform": null,
    "description": "[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n![PyPI version](https://badge.fury.io/py/cursor.svg)\n\n# cursor \nA small Python package to hide or show the terminal cursor.\nWorks on Linux and Windows, on both Python 2 and Python 3.\n\n![demonstration](http://i.imgur.com/2iXviMi.gif)\n\n## Disclaimer\nThe code is almost entirely a copy of\n[James Spencer's](http://stackoverflow.com/u/1375885/) \n[answer on StackOverflow](http://stackoverflow.com/a/10455937/1096437).\n\n\n## Installation\nThe preferred way of installing `cursor` is via `pip`.\nYou can install `pip` with your package manager:\n\n#### On Ubuntu:\n    \n    sudo apt-get install python-pip\n    pip install --user cursor\n\n#### On Arch:\n    \n    git clone https://aur.archlinux.org/python-cursor.git\n    cd python-cursor\n    makepkg -si\n\n## Usage\n\n```python\nimport cursor\ncursor.hide() ## Hides the cursor\ncursor.show() ## Shows the cursor\n```\n\n\nNote that the cursor will stay hidden until you call `cursor.show()` \u2014 \neven after exiting your python script!\n\nBecause of that, `pip` will install two scripts, which can be run\nfrom the command line: `cursor_hide` and `cursor_show`.\n\nAn alternative is using the `HiddenCursor()` class in conjunction\nwith Python's `with` statement. This will make sure that the cursor\nis shown again after running your code, even if exceptions are\nraised:\n\n```python\nimport cursor\nwith cursor.HiddenCursor():     ## Cursor will stay hidden\n    import time                 ## while code is being executed;\n    for a in range(1,100):      ## afterwards it will show up again\n        print(a)\n        time.sleep(0.05)\n    \n```\n\nYou could also use Python's `atexit` module:\n\n```python\nimport cursor\nimport atexit\nimport time\n\natexit.register(cursor.show)    ## Make sure cursor.show() is called\n                                ## when exiting\n\ncursor.hide()                   ## Hides cursor\nfor a in range(1,100):\n    print(a)\n    time.sleep(0.05)\nexit()                          ## Cursor will show again\n```\n\n## Contributors\n[Manraj Singh](https://github.com/ManrajGrover): allowed setting\na customisable stream \n\n[Alexander Seiler](https://github.com/goggle): packaging for Arch\n\nPatrik Kopkan: packaging for Fedora\n\n\n## Projects using `cursor`\n[`halo`](https://github.com/ManrajGrover/halo): beautiful \nterminal spinners in Python\n\n[`pipenv`](https://github.com/pypa/pipenv): a tool that aims to bring the best of all packaging worlds to the Python world",
    "bugtrack_url": null,
    "license": "",
    "summary": "A small Python package to hide or show the terminal cursor",
    "version": "1.3.5",
    "project_urls": {
        "Homepage": "https://github.com/GijsTimmers/cursor"
    },
    "split_keywords": [
        "cursor",
        "terminal",
        "hide",
        "show"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "591bae231e1f9a8e1f970453f92fcb20a3fce87fa38753915477c26bc1655d86",
                "md5": "dec469fad4a8f0cd586c16b26a05374e",
                "sha256": "6758cae6ac14765ec85d9ce3f14fcb98fff5045f06d8398f1e8da8ce3acd2f20"
            },
            "downloads": -1,
            "filename": "cursor-1.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "dec469fad4a8f0cd586c16b26a05374e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15666,
            "upload_time": "2022-06-15T12:39:56",
            "upload_time_iso_8601": "2022-06-15T12:39:56.774149Z",
            "url": "https://files.pythonhosted.org/packages/59/1b/ae231e1f9a8e1f970453f92fcb20a3fce87fa38753915477c26bc1655d86/cursor-1.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-15 12:39:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "GijsTimmers",
    "github_project": "cursor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cursor"
}
        
Elapsed time: 1.53651s