[英]How to copy a file/image to the clipboard in Linux using Python
I can't find a way to copy an image or a file to the clipboard.我找不到将图像或文件复制到剪贴板的方法。 I tried using pyperclip but it isn't able to do that.
我尝试使用 pyperclip,但它无法做到这一点。
I found a way to do this using a shell command:我找到了一种使用 shell 命令的方法:
os.system(f"xclip -selection clipboard -t image/png -i {path + '/image.png'}")
It's less than ideal but it does the job.它不太理想,但可以完成工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.