I've seen this question and i followed every step, changing the code to satisfy my requirements, that are Python3, Pillow, and ctypes. The less libraries, the better.
import ctypesfrom PIL import ImageGrab, Imagefrom io import BytesIOuser32 = ctypes.windll.user32img = ImageGrab.grab()output = BytesIO()img.convert("RGB").save(output, "BMP")data = output.getvalue()[14:]output.close()user32.OpenClipboard()user32.EmptyClipboard()user32.SetClipboardData(user32.CF_DIB, data)user32.CloseClipboard()
That is the stripped code from my script that, i think, is the same code in the question ported to my requirements. When executed, it should copy the current desktop to the clipboard. I get this instead:
File "C:\Users\Gcq\Documents\python\Screen\Screen.py", line 132, in shot user32.OpenClipboard()ValueError: Procedure probably called with not enough arguments (4 bytes missing)
I'm sorry i'm asking such a (probably) easy question here, but i really don't know what is failing, and ctypes is not my thing.