addcopyfighandler


Nameaddcopyfighandler JSON
Version 3.2.4 PyPI version JSON
download
home_pageNone
SummaryAdds a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard
upload_time2024-09-06 19:02:20
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 / Cmd+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 (or Cmd+C on MacOS) 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.).

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.


## MacOS-specific behavior:

- Requires Qt, whether PyQt5/6 or PySide2/6.
- The figure will be copied to the clipboard as a PNG, regardless of matplotlib.rcParams['savefig.format'].

Releases
--------
### 3.2.4: 2024-09-03

- Fix [issue when using the Agg backend on Windows](https://github.com/joshburnett/addcopyfighandler/issues/20), which doesn't support get_window_title().

### 3.2.3: 2024-09-03

- Fixed [an issue with copying when there are multiple figures](https://github.com/joshburnett/addcopyfighandler/issues/19).

### 3.2.2: 2024-06-24

- Thanks to @rgw5267 for finding and fixing [a bug related to the event handler being registered multiple times](https://github.com/joshburnett/addcopyfighandler/issues/17).

### 3.2.1: 2024-06-13

- Made backend checks case-insensitive due to undocumented changes in matplotlib 3.9.

### 3.2.0: 2024-02-13

- Added MacOS support (thanks @orlp!). No SVG support, same as Linux.

### 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/62/35/e3a2bf8d34601675557e4d3d5023dc911ecc344a9f3e4f818b15a2c3cb9e/addcopyfighandler-3.2.4.tar.gz",
    "platform": null,
    "description": "addcopyfighandler: Add a Ctrl+C / Cmd+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 (or Cmd+C on MacOS) 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\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\n## MacOS-specific behavior:\n\n- Requires Qt, whether PyQt5/6 or PySide2/6.\n- The figure will be copied to the clipboard as a PNG, regardless of matplotlib.rcParams['savefig.format'].\n\nReleases\n--------\n### 3.2.4: 2024-09-03\n\n- Fix [issue when using the Agg backend on Windows](https://github.com/joshburnett/addcopyfighandler/issues/20), which doesn't support get_window_title().\n\n### 3.2.3: 2024-09-03\n\n- Fixed [an issue with copying when there are multiple figures](https://github.com/joshburnett/addcopyfighandler/issues/19).\n\n### 3.2.2: 2024-06-24\n\n- Thanks to @rgw5267 for finding and fixing [a bug related to the event handler being registered multiple times](https://github.com/joshburnett/addcopyfighandler/issues/17).\n\n### 3.2.1: 2024-06-13\n\n- Made backend checks case-insensitive due to undocumented changes in matplotlib 3.9.\n\n### 3.2.0: 2024-02-13\n\n- Added MacOS support (thanks @orlp!). No SVG support, same as Linux.\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\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Adds a Ctrl+C handler to matplotlib figures for copying the figure to the clipboard",
    "version": "3.2.4",
    "project_urls": {
        "Repository": "https://github.com/joshburnett/addcopyfighandler"
    },
    "split_keywords": [
        "addcopyfighandler",
        " figure",
        " matplotlib",
        " handler",
        " copy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "504302771c3380d13a91d09ac5aaf693e5a42a457453700536122e65596d06a0",
                "md5": "dc860dec8041f76307934ae03f6393fc",
                "sha256": "70a0aa648c7d29680d9460f08767a8a1b645a77c2bdefdd5213c5324fd93fee5"
            },
            "downloads": -1,
            "filename": "addcopyfighandler-3.2.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc860dec8041f76307934ae03f6393fc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 6350,
            "upload_time": "2024-09-06T19:02:19",
            "upload_time_iso_8601": "2024-09-06T19:02:19.650373Z",
            "url": "https://files.pythonhosted.org/packages/50/43/02771c3380d13a91d09ac5aaf693e5a42a457453700536122e65596d06a0/addcopyfighandler-3.2.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6235e3a2bf8d34601675557e4d3d5023dc911ecc344a9f3e4f818b15a2c3cb9e",
                "md5": "3243b629691df71b68662c9867cc54ca",
                "sha256": "b3f2f349a448f27756fa94ca78c485bf8b32b0a81507f719f3b8c1cb33539614"
            },
            "downloads": -1,
            "filename": "addcopyfighandler-3.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "3243b629691df71b68662c9867cc54ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5645,
            "upload_time": "2024-09-06T19:02:20",
            "upload_time_iso_8601": "2024-09-06T19:02:20.913055Z",
            "url": "https://files.pythonhosted.org/packages/62/35/e3a2bf8d34601675557e4d3d5023dc911ecc344a9f3e4f818b15a2c3cb9e/addcopyfighandler-3.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 19:02:20",
    "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: 3.14917s