Clipboard
The 'clipboard' library (terryyin/clipboard) is a Python module designed for cross-platform clipboard operations across Windows, Mac, and Linux. Despite its name, the project's own README suggests that its functionality is largely superseded by 'pyperclip'. It is an older library, with its last PyPI release in 2014, and is no longer actively maintained.
Warnings
- breaking This library is effectively abandoned. Its last release was in 2014, and the GitHub repository itself explicitly states that 'everything is included in pyperclip already'. It is highly recommended to use 'pyperclip' instead for active development and maintenance.
- gotcha The 'clipboard' library (terryyin/clipboard) has not seen updates for many years. It may have compatibility issues with newer Python versions (beyond Python 3.3, which it officially supported at release) and modern operating system clipboard mechanisms.
- gotcha This library may only reliably handle plain text. More advanced clipboard operations, such as handling rich text (HTML, RTF) or images, are unlikely to be supported by this older, unmaintained library.
Install
-
pip install clipboard
Imports
- copy
from clipboard import copy
import clipboard clipboard.copy('text') - paste
from clipboard import paste
import clipboard text = clipboard.paste()
Quickstart
import clipboard
# Copy text to the clipboard
clipboard.copy('Hello, world!')
print('Text copied to clipboard.')
# Paste text from the clipboard
pasted_text = clipboard.paste()
print(f'Text pasted from clipboard: {pasted_text}')