addcopyfighandler


Nameaddcopyfighandler JSON
Version 3.1.1.post1 PyPI version JSON
download
home_pageNone
SummaryAdds a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard
upload_time2024-02-13 21:18:55
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords addcopyfighandler figure matplotlib handler copy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            addcopyfighandler: Add a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard
======================================================================================================

Importing this module (after importing matplotlib or pyplot) will add a handler
to all subsequently-created matplotlib figures
so that pressing Ctrl+C with a matplotlib figure window selected will copy
the figure to the clipboard as an image.  The copied image is generated through
matplotlib.pyplot.savefig(), and thus is affected by the relevant rcParams
settings (savefig.dpi, savefig.format, etc.).

Windows and Linux are currently supported. Pull requests implementing macOS support are welcome.

Uses code & concepts from:
- https://stackoverflow.com/questions/31607458/how-to-add-clipboard-support-to-matplotlib-figures
- https://stackoverflow.com/questions/34322132/copy-image-to-clipboard-in-python3


## Windows-specific behavior:

- addcopyfighandler should work regardless of which graphical backend is being used by matplotlib
    (tkagg, gtk3agg, qtagg, etc.).
- If `matplotlib.rcParams['savefig.format']` is `'svg'`, the figure will be copied to the clipboard
    as an SVG.
- If Pillow is installed, all non-SVG format specifiers will be overridden, and the
    figure will be copied to the clipboard as a Device-Independant Bitmap.
- If Pillow is not installed, the supported format specifiers are `'png'`, `'jpg'`, `'jpeg'`, and `'svg'`.
    All other format specifiers will be overridden, and the figure will be copied to the clipboard as PNG data.


## Linux-specific behavior:

- Requires either Qt or GTK libraries for clipboard interaction. Automatically detects which is being used from
    `matplotlib.get_backend()`.
    - Qt support requires `PyQt5`, `PyQt6`, `PySide2` or `PySide6`.
    - GTK support requires `pycairo`, `PyGObject` and `PIL` or `pillow` to be installed.
      - Only GTK 3 is supported, as GTK 4 has totally changed the way clipboard data is handled and I can't figure
        it out. I'm totally open to someone else solving this and submitting a PR if they want. I don't use GTK.
- The figure will be copied to the clipboard as a PNG, regardless of `matplotlib.rcParams['savefig.format']`. Alas, SVG output is not currently supported. Pull requests that enable SVG support would be welcomed.


Releases
--------
### 3.1.1: 2024-02-13

- Wrap matplotlib.pyploy.figure appropriately to maintain docstring (thanks @eendebakpt!)

### 3.1.0: 2024-02-13

- Add support for PyQt6 and PySide6 on Linux (already supported on Windows)

### 3.0.0: 2021-03-28

- Add Linux support (tested on Ubuntu). Requires PyQt5, PySide2, or PyObject libraries; relevant library chosen based on matplotlib graphical backend in use. No SVG support.
- On Windows, non SVG-formats will now use the Pillow library if installed, storing the figure to the clipboard as a device-indepenent bitmap (as previously handled in v2.0). This is compatible with a wider range of Windows applications.

### 2.1.0: 2020-08-27

- Remove Pillow.
- Add support for png & svg file formats.

### 2.0.0: 2019-06-07

- Remove Qt requirement. Now use Pillow to grab the figure image, and win32clipboard to manage the Windows clipboard.


### 1.0.2: 2018-11-27

- Force use of Qt4Agg or Qt5Agg. Some installs will default to TkAgg backend, which this module
doesn't support. Forcing the backend to switch when loading this module saves the user from having
to manually specify one of the Qt backends in every analysis.


### 1.0.1: 2018-11-27

- Improve setup.py: remove need for importing module, add proper installation dependencies
- Change readme from ReST to Markdown


### 1.0: 2017-08-09

- Initial release


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "addcopyfighandler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "addcopyfighandler,figure,matplotlib,handler,copy",
    "author": null,
    "author_email": "Josh Burnett <github@burnettsonline.org>",
    "download_url": "https://files.pythonhosted.org/packages/1f/c3/c0ef5418b043f238def189fa99b681310e2bd31ab5d4f635e00d5cabeba3/addcopyfighandler-3.1.1.post1.tar.gz",
    "platform": null,
    "description": "addcopyfighandler: Add a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard\n======================================================================================================\n\nImporting this module (after importing matplotlib or pyplot) will add a handler\nto all subsequently-created matplotlib figures\nso that pressing Ctrl+C with a matplotlib figure window selected will copy\nthe figure to the clipboard as an image.  The copied image is generated through\nmatplotlib.pyplot.savefig(), and thus is affected by the relevant rcParams\nsettings (savefig.dpi, savefig.format, etc.).\n\nWindows and Linux are currently supported. Pull requests implementing macOS support are welcome.\n\nUses code & concepts from:\n- https://stackoverflow.com/questions/31607458/how-to-add-clipboard-support-to-matplotlib-figures\n- https://stackoverflow.com/questions/34322132/copy-image-to-clipboard-in-python3\n\n\n## Windows-specific behavior:\n\n- addcopyfighandler should work regardless of which graphical backend is being used by matplotlib\n    (tkagg, gtk3agg, qtagg, etc.).\n- If `matplotlib.rcParams['savefig.format']` is `'svg'`, the figure will be copied to the clipboard\n    as an SVG.\n- If Pillow is installed, all non-SVG format specifiers will be overridden, and the\n    figure will be copied to the clipboard as a Device-Independant Bitmap.\n- If Pillow is not installed, the supported format specifiers are `'png'`, `'jpg'`, `'jpeg'`, and `'svg'`.\n    All other format specifiers will be overridden, and the figure will be copied to the clipboard as PNG data.\n\n\n## Linux-specific behavior:\n\n- Requires either Qt or GTK libraries for clipboard interaction. Automatically detects which is being used from\n    `matplotlib.get_backend()`.\n    - Qt support requires `PyQt5`, `PyQt6`, `PySide2` or `PySide6`.\n    - GTK support requires `pycairo`, `PyGObject` and `PIL` or `pillow` to be installed.\n      - Only GTK 3 is supported, as GTK 4 has totally changed the way clipboard data is handled and I can't figure\n        it out. I'm totally open to someone else solving this and submitting a PR if they want. I don't use GTK.\n- The figure will be copied to the clipboard as a PNG, regardless of `matplotlib.rcParams['savefig.format']`. Alas, SVG output is not currently supported. Pull requests that enable SVG support would be welcomed.\n\n\nReleases\n--------\n### 3.1.1: 2024-02-13\n\n- Wrap matplotlib.pyploy.figure appropriately to maintain docstring (thanks @eendebakpt!)\n\n### 3.1.0: 2024-02-13\n\n- Add support for PyQt6 and PySide6 on Linux (already supported on Windows)\n\n### 3.0.0: 2021-03-28\n\n- Add Linux support (tested on Ubuntu). Requires PyQt5, PySide2, or PyObject libraries; relevant library chosen based on matplotlib graphical backend in use. No SVG support.\n- On Windows, non SVG-formats will now use the Pillow library if installed, storing the figure to the clipboard as a device-indepenent bitmap (as previously handled in v2.0). This is compatible with a wider range of Windows applications.\n\n### 2.1.0: 2020-08-27\n\n- Remove Pillow.\n- Add support for png & svg file formats.\n\n### 2.0.0: 2019-06-07\n\n- Remove Qt requirement. Now use Pillow to grab the figure image, and win32clipboard to manage the Windows clipboard.\n\n\n### 1.0.2: 2018-11-27\n\n- Force use of Qt4Agg or Qt5Agg. Some installs will default to TkAgg backend, which this module\ndoesn't support. Forcing the backend to switch when loading this module saves the user from having\nto manually specify one of the Qt backends in every analysis.\n\n\n### 1.0.1: 2018-11-27\n\n- Improve setup.py: remove need for importing module, add proper installation dependencies\n- Change readme from ReST to Markdown\n\n\n### 1.0: 2017-08-09\n\n- Initial release\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Adds a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard",
    "version": "3.1.1.post1",
    "project_urls": {
        "Repository": "https://github.com/joshburnett/addcopyfighandler"
    },
    "split_keywords": [
        "addcopyfighandler",
        "figure",
        "matplotlib",
        "handler",
        "copy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e48a2753b99e36a556b9b74040ef52d01dd7b44dd8b8ae5db60e014ba7b7d019",
                "md5": "2aa4ab47345a94a5973a08a9812b07c4",
                "sha256": "d101df1528281fed34e9e78c34e9fb3d49519558f229f9196a789e3df8127f94"
            },
            "downloads": -1,
            "filename": "addcopyfighandler-3.1.1.post1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2aa4ab47345a94a5973a08a9812b07c4",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 6832,
            "upload_time": "2024-02-13T21:18:53",
            "upload_time_iso_8601": "2024-02-13T21:18:53.357139Z",
            "url": "https://files.pythonhosted.org/packages/e4/8a/2753b99e36a556b9b74040ef52d01dd7b44dd8b8ae5db60e014ba7b7d019/addcopyfighandler-3.1.1.post1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1fc3c0ef5418b043f238def189fa99b681310e2bd31ab5d4f635e00d5cabeba3",
                "md5": "9ef772a853f3905a6c9073d826d4617a",
                "sha256": "3bb61c832b78d0825b070e157548831a757ec4c604c3639a46e5e15cd23d2399"
            },
            "downloads": -1,
            "filename": "addcopyfighandler-3.1.1.post1.tar.gz",
            "has_sig": false,
            "md5_digest": "9ef772a853f3905a6c9073d826d4617a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5748,
            "upload_time": "2024-02-13T21:18:55",
            "upload_time_iso_8601": "2024-02-13T21:18:55.059665Z",
            "url": "https://files.pythonhosted.org/packages/1f/c3/c0ef5418b043f238def189fa99b681310e2bd31ab5d4f635e00d5cabeba3/addcopyfighandler-3.1.1.post1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-13 21:18:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshburnett",
    "github_project": "addcopyfighandler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "addcopyfighandler"
}
        
Elapsed time: 0.18796s