Skip to main content

A cross-platform clipboard module for Python.

Project description

I got tired of not having a good cross-platform module for accessing the clipboard in Python, so I put this together. It is a module that loads a copy() and paste() function depending on what your operating system (or window manager) is.

It has the following requirements:
  • Windows - No requirements. You don’t need the win32 module installed.

  • Mac - Requires the pbcopy and pbpaste, which come with OS X.

  • Linux - Requires the xclip command, which possibly comes with the os.

    If not, run sudo apt-get install xclip. Or have the gtk or PyQt4 modules installed.

Pyperclip runs on both Python 2 and Python 3.

Usage is simple:

import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
spam = pyperclip.paste()
Change Log:
  • 1.2 Use the platform module to help determine OS.

  • 1.3 Changed ctypes.windll.user32.OpenClipboard(None) to ctypes.windll.user32.OpenClipboard(0), after some people ran into some TypeError

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyperclip-1.3.zip (5.0 kB view details)

Uploaded Source

File details

Details for the file pyperclip-1.3.zip.

File metadata

  • Download URL: pyperclip-1.3.zip
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyperclip-1.3.zip
Algorithm Hash digest
SHA256 c2ab819dc1387dea118ef58b0523d38ddf4bd985fe887689d3cc51f7a3eecc37
MD5 9242f1cba0f2db72672fbc5ee2edc7e5
BLAKE2b-256 62b06dcf40b773addc85c858c0fbdf6ebccf5fb583f185afc9d06e77d8de1ce4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page