En Wed, 01 Apr 2009 19:20:43 -0300, Simon Hibbs <simon.hi...@gmail.com> escribió:
On 1 Apr, 21:43, Gary Herron <gher...@islandtraining.com> wrote:
Simon Hibbs wrote:

> I'm trying to dump a snapshot of my application window to the
> clipboard. I can use ImageGrab in PIL to get the screen data into a
> PIL image object, which i have converted to a bitmap using ImageWin,
> but when I try to pass this to the clipboard using -

> win32clipboard.SetClipboardData(win32clipboard.CF_BITMAP, img)

> It fails, telling be that "The object must support the buffer
> interface".

The second argument to SetClipboardData should be a handle to a bitmap resource, not a string.
See win32\test\test_clipboard.py for an example.

PS: Hmm, looking at SetClipboardData, seems that a string containing the data in the right format *might* work too. But it's easier to use LoadImage than building the resource by hand, I think.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to