Clipboard is not set after application exits?

2019-07-07 04:01发布

问题:

With this example from How do I copy a string to the clipboard on Windows using Python? :

from tkinter import Tk
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append('i can has clipboardz?')
r.destroy()

The clipboard reverts to the old clipboard. Is there any way to avoid this? I'm using Ubuntu 13.04.

回答1:

No. The "clipboard" on X is not a discrete thing, but rather a notification that an application contains the piece of data that is seen as being "on" the clipboard. Other applications request this piece of data from that application, and the data is returned. This cannot work if the application that is supposed to respond with the data is no longer running.