Skip to content

sebastiandev/clipton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clipton

A cross platform clipboard that makes it easy and transparent to access and interact with the native clipboard

Currently supported clipboards:

  • Windows
  • Linux Gtk
  • Linux Qt

Examples

Getting the clipboard

import clipton
clipboard = clipon.get_clipboard()

Adding content to the clipboard

import clipton
clipboard = clipon.get_clipboard()
clipboard.copy("hello clipton!")  # default expects unicode text
clipboard.copy("<html><body><p>texto html</p></body></html>", clipboard.HTML)  # specifying the data format (html)

Checking the available formats of clipboard's data

import clipton
clipboard = clipon.get_clipboard()
clipboard.formats()
>> [(13, 'unicodetext'),
>> (16, 'locale'),
>> (1, 'text'),
>> (7, 'oemtext')]

Retrieving clipboard data as text

import clipton
clipboard = clipon.get_clipboard()
clipboard.text()
>> u"hello clipton!"

Retrieving clipboard data in a specific format

import clipton
clipboard = clipon.get_clipboard()
clipboard.paste(clipboard.TEXT)  # unicode
>> u"hello clipton!"

Retrieving clipboard contents in all formats

import clipton
clipboard = clipon.get_clipboard()
clipboard.contents()
>> {'locale': '\n,',
>> 'oemtext': 'hello clipton!',
>> 'text': 'hello clipton!',
>> 'unicodetext': u'hello clipton!'}

Releases

No releases published

Packages

No packages published

Languages