{ "info": { "author": "Tomas Ravinskas", "author_email": "tomas.rav@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Win32 (MS Windows)", "Environment :: X11 Applications", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "# klembord\n\n`klembord` is a python 3 package that provides full clipboard access on supported platforms (Linux and Windows for now, though this may change in the future).\n`klembord` has minimal dependencies, depending only on platform specific apis, which means it can be used with any graphics toolkit or without a toolkit at all.\n\n## Install and dependencies\n\n`klembord` uses `python-xlib` under Linux and `ctypes` on Windows.\nWhen installing with `pip` dependencies will be taken care of automatically.\n\n`pip install klembord`\n\nThat's it!\n\n## Usage\n\n```python\n>>> import klembord\n>>> klembord.init()\n>>> klembord.get_text()\n'example clipboard text'\n>>>klembord.set_text('some string')\n```\n\n`klembord` also includes convenience functions for working with rich text:\n\n```python\n>>> klembord.get_with_rich_text()\n('example html', 'example html')\n>>> klembord.set_with_rich_text('plain text', 'plain text')\n```\n\nRich text function set platform's unicode and html formats.\n\nOn Linux accessing selections other than `CLIPBOARD` is easy, just pass selection name to `init`:\n\n```python\nklembord.init('PRIMARY')\n```\n\nIf you need access to other targets/formats you can use `get` and `set` functions:\n\n```python\n>>> content = {'UTF8_STRING': 'string'.encode(), 'text/html': 'string'.encode()}\n>>> klembord.set(content)\n>>> klembord.get(['UTF8_STRING', 'text/html', 'application/rtf'])\n{'UTF8_STRING': b'string', 'text/html': b'string', 'application/rtf': None}\n\n>>> from collections import OrderedDict\n>>> content = OrderedDict()\n>>> content['HTML Format'] = klembord.wrap_html('Example')\n>>> content['CF_UNICODETEXT'] = 'Example'.encode('utf-16le')\n>>> klembord.set(content)\n>>> klembord.get(['HTML Format', 'CF_RTF'])\n{'HTML Format': b'Example', 'CF_RTF': None}\n```\n\nThese examples show manual way of setting clipboard with rich text.\nUnlike convenience functions `get` and `set` takes dicts of bytes as arguments.\nKey should be target/format string and value binary data or encoded string. Every given format/target will be set.\n\nThe first example is Linux usage. Most targets are encoded with `utf8` and it's all fairly simple.\nThe second shows usage on Windows. Now windows retrieves formats in order they were defined, so using `collections.OrderedDict` is a good idea to ensure that say html format takes precedence over plain text.\n`CF_UNICODE`, the unicode text format is always encoded in `utf-16le`.\nIf you set this target with `utf8` you'll get unknown characters when pasting.\nAnother thing to note is the `wrap_html` function. While setting plain html works on Linux, Windows uses it's own (unnecessary) format. This function takes html fragment string and returns formatted bytes object.\n`wrap_html` is only available on Windows.\n\nTo list available targets/formats:\n\n```python\n>>> klembord.get(['TARGETS'])\n{'TARGETS': ['TARGETS', 'SAVE_TARGETS', 'UTF8_STRING', 'STRING']}\n```\n\n### Clipboard persistence on Linux\n\nAs of version 0.1.3 klembord supports storing content in clipboard after application\nexit. You do need to call `klembord.store()` explicitly. Note that this method\nraises `AttributeError` on Windows.\n\n## Why klembord\n\nklembord means clipboard in dutch. Since every reasonable name in english was taken on pypi, I decided to cosult a dictionary.\nNow you might think since there're so many packages for clipboard access `klembord` is unnecessary.\nAlas, all the other packages only work with plain text, depend on heavy toolkits or external executables, and in one particular case the entire package simply imports copy and paste functions from pyperclip.\nI found the situation rather sad, so I decided to write `klembord`.\n\n## Bugs and limitations\n\n* Setting binary formats should work in theory but it's mostly untested.\n* Setting/getting Windows built in binary formats (e.g. `CF_BITMAP`) doesn't work and WILL crash python. These require special handling which is currently not implemented in `klembord`", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/OzymandiasTheGreat/klembord", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "klembord", "package_url": "https://pypi.org/project/klembord/", "platform": "", "project_url": "https://pypi.org/project/klembord/", "project_urls": { "Homepage": "https://github.com/OzymandiasTheGreat/klembord" }, "release_url": "https://pypi.org/project/klembord/0.1.3/", "requires_dist": null, "requires_python": ">=3.4", "summary": "Full toolkit agnostic cross-platform clipboard access", "version": "0.1.3" }, "last_serial": 4576747, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1d81366fc5f81d4af7d9907a58f8ce54", "sha256": "5078540f52bc8439e5d8467ac8540ce5da5c46100a64b1ba0f528f8484db1fda" }, "downloads": -1, "filename": "klembord-0.1.tar.gz", "has_sig": false, "md5_digest": "1d81366fc5f81d4af7d9907a58f8ce54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6028, "upload_time": "2018-01-04T11:06:56", "url": "https://files.pythonhosted.org/packages/8f/b1/86dfbc108b241e1216631833dae93dc4126e0cc7fe8371567f520616ccb7/klembord-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "0dd961f344b1e033956ecaccd7019ff0", "sha256": "d4200318a1222a0fbd1a46be0a33992ab03d19ee3720a00974f8e3451e1ae65e" }, "downloads": -1, "filename": "klembord-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0dd961f344b1e033956ecaccd7019ff0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6105, "upload_time": "2018-01-04T12:45:02", "url": "https://files.pythonhosted.org/packages/b9/01/808df8cb5924981e6919ace219442271e5465f66a5dc47034964f0a1f198/klembord-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1648d87e0818b973fa0aa0b7d0e35fdc", "sha256": "cb4ea52b1d219103b24374e2222626d2e858162c1f955eafad0381e40fd57213" }, "downloads": -1, "filename": "klembord-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1648d87e0818b973fa0aa0b7d0e35fdc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 7240, "upload_time": "2018-01-12T06:33:04", "url": "https://files.pythonhosted.org/packages/2c/81/cf89ff1d24d01c82e06c8add7d73db9ea228144031ed08ec6e76d2624b57/klembord-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "ce3362281ff254a331149d1cc6ffc4e0", "sha256": "627117e38fb196b7eae03854ab143207abd498d47b0c21eadf4835401d0deefd" }, "downloads": -1, "filename": "klembord-0.1.3.tar.gz", "has_sig": false, "md5_digest": "ce3362281ff254a331149d1cc6ffc4e0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 11069, "upload_time": "2018-12-09T06:35:13", "url": "https://files.pythonhosted.org/packages/e7/6a/9c0faa42433bcaaa91558ec7685dc4bf7b0146ad9159f59abc913ec727d8/klembord-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ce3362281ff254a331149d1cc6ffc4e0", "sha256": "627117e38fb196b7eae03854ab143207abd498d47b0c21eadf4835401d0deefd" }, "downloads": -1, "filename": "klembord-0.1.3.tar.gz", "has_sig": false, "md5_digest": "ce3362281ff254a331149d1cc6ffc4e0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 11069, "upload_time": "2018-12-09T06:35:13", "url": "https://files.pythonhosted.org/packages/e7/6a/9c0faa42433bcaaa91558ec7685dc4bf7b0146ad9159f59abc913ec727d8/klembord-0.1.3.tar.gz" } ] }