I am using win32clipboard module with Python 2.7 in Windows 7. I have code which uses GetClipboardData() and SetClipboardText(argument). Before running the code I copy text into the Windows clipboard from a proprietary program. I know that this program adds garbage to the end of the string, namely null-value bytes and possibly other invisible stuff.

When I paste the contents of the Windows clipboard into a Tkinter text box I get the string obtained by GetClipboardData() although I have since run SetClipboardText(argument).

If I paste the contents of the Windows clipboard at this stage into the Boxer text editor I get the string placed by SetClipboardText(argument). If I paste into the Tkinter program again, or into Vim or into Microsoft Word, I get the string obtained using GetClipboardData(). I can repeat this as many times as I like - one string into Boxer, the other string into the other programs.

I deduce that both strings must be in the clipboard at the same time, but it depends which program has focus which string is pasted in using Control v.

Is there a way of showing the contents of the clipboard, garbage and all? I would like to find a way of making the Windows clipboard behave as it is supposed to - new contents overwriting the old.

Regards

John Sampson

_______________________________________________
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk

Reply via email to