Python clipboard utility that works natively on python to exchange data with the windows clipboard through the win32 API. Is designed particularly to work properly with different image formats (for ImagePaste) but also works with other clipboard formats.
Please refer to the docs for function descriptions, references and more details. Refer to the official win32 API docs for documentation on win32 clipboard API.
Must call open_clipboard()
before using any clipboard function which returns 0 on failure.
Should call empty_clipboard()
before setting any data to clipboard.
Must call close_clipboard()
at the end or other applications may not be able to access the clipboard.
Example (to get unicode text from clipboard):
import clipette
if clipette.open_clipboard():
text = clipette.get_UNICODETEXT()
print(text)
clipette.close_clipboard()
For more examples, refer to the docs
It will be great if you have an idea and turn it into visible. Tell us how amazing they are by suggesting a feature, or you can make it yourself by creating a pull request. And if you encounter a problem, let us know by opening an issue. But before doing anything, let's take a look at our contributing guide, it will show you how to start with all of that.
GetLastError
to enable easier debugging of win32 functions.psd
or jpeg
.While working on ImagePaste, I needed a way to quickly and reliably exchange image data with the clipboard which turned out to be a problem on Windows where the clipboard image standard is kind of a mess. I tried Pillow and shell scripts but neither worked fastly enough or with the required image formats so I ended up developing this module.