ricegf
May 29th, 2008, 03:04 AM
I'm having a PyGTK+ problem. I'd like to transfer a graphics file (say, a JPG or PNG) from disk to the clipboard in Python. The obvious way seems to be:
pixbuf = gtk.gdk.pixbuf_new_from_file(tempfile)
gtk.Clipboard.set_image(pixbuf)
However, this gives the following exception:
gtk.Clipboard.set_image(pixbuf)
TypeError: descriptor 'set_image' requires a 'gtk.Clipboard' object but received a 'gtk.gdk.Pixbuf'
But the documentation for gtk.Clipboard.set_image claims it accepts a pixbuf - which certainly makes more sense than a Clipboard object! Here's the documentation:
gtk.Clipboard.set_image
def set_image(pixbuf)
pixbuf :
a gtk.gdk.Pixbuf.
What am I missing here? Is this a bug in the set_image implementation, documentation, or programmer? :-)
I'm using Ubuntu 8.04 x86 32-bit with the default Python 2.5.2, running "python ./test.py" from the command line.
pixbuf = gtk.gdk.pixbuf_new_from_file(tempfile)
gtk.Clipboard.set_image(pixbuf)
However, this gives the following exception:
gtk.Clipboard.set_image(pixbuf)
TypeError: descriptor 'set_image' requires a 'gtk.Clipboard' object but received a 'gtk.gdk.Pixbuf'
But the documentation for gtk.Clipboard.set_image claims it accepts a pixbuf - which certainly makes more sense than a Clipboard object! Here's the documentation:
gtk.Clipboard.set_image
def set_image(pixbuf)
pixbuf :
a gtk.gdk.Pixbuf.
What am I missing here? Is this a bug in the set_image implementation, documentation, or programmer? :-)
I'm using Ubuntu 8.04 x86 32-bit with the default Python 2.5.2, running "python ./test.py" from the command line.