undo/redo, windows clipboard

John Benson jsbenson at bensonsystems.com
Fri Jan 2 02:17:16 EST 2004


With respect to:

Message: 13
Date: Thu, 1 Jan 2004 18:38:47 -0800 (PST)
From: black <quiteblack at yahoo.com>
Subject: undo and redo ?
To: python-list at python.org
Message-ID: <20040102023847.78427.qmail at web21326.mail.yahoo.com>
Content-Type: text/plain; charset="us-ascii"

I'm coding with Tkinter and i wonder whether we could get current OS'
clipboard available, and event more, anyone can inspires me how we can
achieve undo and redo function ?

(end quote)

I don't know about undo/redo, but I have sent stuff out of Python via the
clipboard. What works for me (courtesy of Mark Hammond) is:

import win32clipboard, win32con


        win32clipboard.OpenClipboard()
        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardText('your string here')
        win32clipboard.CloseClipboard()

I found out that if I didn't empty the clipboard before adding to it, the
new data sometimes ended up in the Microsoft Office clipboard, sometimes
not. Now it just shows up each and every time in the plain old Windows
clipboard.








More information about the Python-list mailing list