应用程序退出后未设置剪贴板? [英] Clipboard is not set after application exits?

查看:71
本文介绍了应用程序退出后未设置剪贴板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以来自如何在Windows上使用Python将字符串复制到剪贴板?

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

剪贴板恢复为旧剪贴板。有什么办法可以避免这种情况?我正在使用Ubuntu 13.04。

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

推荐答案

否。 X上的剪贴板不是离散的东西,而是有关应用程序包含被视为在剪贴板上的数据的通知。其他应用程序从该应用程序请求此数据,然后返回数据。如果本应响应数据的应用程序不再运行,则此方法将无效。

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.

这篇关于应用程序退出后未设置剪贴板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆