[python-win32] How to copy an image using win32clipboard

Steven Manross steven at manross.net
Tue Dec 1 12:38:07 EST 2020


Based on reading http://timgolden.me.uk/pywin32-docs/win32clipboard__GetClipboardData_meth.html I would suggest that getting image data from the clipboard isn't implemented yet, but I do not know that for sure as I don't know when that document was updated.

However, this python code seems to get text data just fine.

import win32clipboard


win32clipboard.OpenClipboard()
var = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()

print(var)

I would also point out that it seems that the "CloseClipboard" is incredibly important as it seems that python takes an exclusive lock on the clipboard while the Clipboard is Opened.

HTH

Steven
---------------
Date: Tue, 1 Dec 2020 11:00:52 +0000
From: Pranav Gadre <pranav.gadre at outlook.com>
To: "python-win32 at python.org" <python-win32 at python.org>
Subject: [python-win32] How to copy an image using win32clipboard
Message-ID:
	<SG2PR01MB3400FB3B4A7AD19C1F7D21789DF40 at SG2PR01MB3400.apcprd01.prod.exchangelabs.com>
	
Content-Type: text/plain; charset="windows-1252"

Hello,

When we take a snip on windows OS, it automatically goes to clipboard. I want to access any copied image using win32clipboard. How do I do that?
Please check this for more reference: Closed issue<https://github.com/mhammond/pywin32/issues/1627>
Thank you and pardon me for any missing things as I?m new to this mailing list.
Regards,
Pranav





More information about the python-win32 mailing list