win32cliboard behavior

Tim Daneliuk tundra at
Tue Oct 8 21:10:07 CEST 2002

Tim Daneliuk wrote:
> Hmmm -  I see behavior I cannot understand, nor have I been able to
> get any clarity from the docs.  I want to *write* to the clipboard
> from a python app and have that information appear in other normal
> Win32 apps when they Paste.  Here's the code (cb is a string):
> win32clipboard.OpenClipboard()
> win32clipboard.SetClipboardText(cb)
> #print win32clipboard.GetClipboardData()
> win32clipboard.CloseClipboard()
> When I do this, the clipboard does indeed contain my text (confirmed
> by uncommenting the next-to-last print statement).  HOWEVER, other
> applications do not see this on their clipboards.  I guess what I
> am asking is how to make my clipboard updates globally visible to
> all windows apps.    A pointer to a good documentation reference will
> suffice...

Well, I discovered the problem (and solution) but I don't understand it.
Apparently, one must *empty* the clipboard before a write to it
is globally visible - apparently emptying it is required to "own"
the clipboard.  Can one of you windows gurus 'splain why this is so?
I would expect the clipboard to just be readable and writable by everyone...

Tim Daneliuk
tundra at

More information about the Python-list mailing list