Skip to content

python clipboard utility that works natively on python with its inbuilt modules to exchange text and images with the windows clipboard

License

Notifications You must be signed in to change notification settings

b-init/clipette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipette

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.

Documentation

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.

Usage

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

Contributing

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.

Todo

  • Implement GetLastError to enable easier debugging of win32 functions.
  • Add support for more Image Formats like psd or jpeg.
  • Add tests.

Why?

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.

About

python clipboard utility that works natively on python with its inbuilt modules to exchange text and images with the windows clipboard

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages