I'd like to copy HTML (and a plain text equivalent) to the clipboard in a Linux GUI environment. Cross-platform is ideal, although Linux is my immediate target. I'd also like to use something that works in Python 3.x as well as 2.x.
According to PyGObject docs, a Gtk.Clipboard
object set_with_data()
method should be suitable. But when I try to use it, there is no set_with_data
member of the class.
>>> from gi.repository import Gtk, Gdk
>>> clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
>>> clipboard.set_with_data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Clipboard' object has no attribute 'set_with_data'
How can I copy HTML plus plaintext to the clipboard using PyGObject?
(I might consider using PyGTK, however according to this answer it is deprecated and not supported in Python 3.x.)