AceofSpades5757 / clip-util

Package for accessing the clipboard with Python, supporting HTML, RTF, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pre-commit Code style: black

PyPI PyPI - Python Version PyPI - License

Tests

Read the Docs

Description

Package for accessing the clipboard with Python.

Installation

pip install clip-util

Features

Windows Only

Allows for text and HTML on Windows.

Supported Clipboard Formats

  • Text
  • HTML
  • RTF

Usage

Clipboard

Will open and close every time the values are set, or retrieved. It's better to use a context manager.

from clipboard import Clipboard


clipboard = Clipboard()

# Set Clipboard
clipboard['text'] = 'Hello World!'
# OR
clipboard.set_clipboard('text') = 'Hello World!'

# Get Clipboard
text = clipboard['text']
# OR
text = clipboard.get_clipboard('text')

Context Manager

from clipboard import Clipboard


with Clipboard() as clipboard:

    # Set Clipboard
    clipboard['text'] = 'Hello World!'
    # OR
    clipboard.set_clipboard('text') = 'Hello World!'

    # Get Clipboard
    text = clipboard['text']
    # OR
    text = clipboard.get_clipboard('text')

See Clipboard Formats

ClipboardFormats : Enum for clipboard formats.

ClipboardFormats.CF_HTML : Represents HTML format.

ClipboardFormats.CF_RTF : Represents RTF format.

from clipboard import Clipboard
from clipboard import ClipboardFormats
from clipboard import HTMLClipboard

About

Package for accessing the clipboard with Python, supporting HTML, RTF, and more.

License:MIT License


Languages

Language:Python 96.4%Language:Makefile 3.6%