Clipboard is not set after application exits?

2019-07-07 03:02发布

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条回答
一纸荒年 Trace。
2楼-- · 2019-07-07 03:46

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.

查看更多
登录 后发表回答