need help! 0 Newbie Poster

My mission is to reproduce the "print screen" button. Must be in memory(no saving the file...).

import PIL
import ImageWin as IW
import ImageGrab
import win32clipboard, win32con
img=ImageGrab.grab()
img=IW.Dib(img)
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32con.CF_BITMAP, img)
win32clipboard.CloseClipboard()

raises TypeError: expected a readable buffer object!

I tried using the tostring method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.