如何将图片从画布复制到剪贴板? [英] How to copy a picture from canvas to clipboard?

查看:106
本文介绍了如何将图片从画布复制到剪贴板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些Tkinter画布以及一些线条和文字图片。有没有简单的方法可以将其复制到剪贴板?

I have some Tkinter canvas and some picture of lines and text on it. Is there an easy way to copy it to a clipboard?

推荐答案

您可以使用 .postscript 方法获取内容的封装PostScript(EPS)表示形式。然后,使用` ImageMagick 的Python绑定( PythonMagick PythonMagickWand )将EPS转换为Windows增强型图元文件(EMF)。最后,将其复制到剪贴板(例如,使用 nosklo的解决方案)与 CF_ENHMETAFILE 剪贴板格式。

You could use .postscript method of the canvas to get an Encapsulated PostScript (EPS) representation of the contents. Then, use `ImageMagick's Python bindings (PythonMagick or PythonMagickWand) to convert the EPS to a Windows Enhanced Metafile (EMF). Finally, copy it to the clipboard (e.g. using nosklo's solution) with the CF_ENHMETAFILE clipboard format.

这篇关于如何将图片从画布复制到剪贴板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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