python可以将文本发送到Mac剪贴板吗 [英] Can python send text to the Mac clipboard

查看:271
本文介绍了python可以将文本发送到Mac剪贴板吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的python程序在Mac剪贴板中放置一些文本.

I'd like my python program to place some text in the Mac clipboard.

这可能吗?

推荐答案

新答案:

此页面建议:

所有Mac OS X的实施 版本

Implementation for All Mac OS X Versions

另一个Mac模块 (清单4中的MacSharedClipboard.py) 在上实现剪贴板接口 两个命令行程序的顶部 称为pbcopy(将文本复制到 剪贴板)和pbpaste(其中 粘贴其中的任何文本 剪贴板).前缀"pb"代表 Mac中的术语粘贴板" 剪贴板.

The other Mac module (MacSharedClipboard.py, in Listing 4) implements the clipboard interface on top of two command-line programs called pbcopy (which copies text into the clipboard) and pbpaste (which pastes whatever text is in the clipboard). The prefix "pb" stands for "pasteboard," the Mac term for clipboard.

旧答案:

显然是这样:

http://code.activestate.com/recipes/410615/

是演示如何执行操作的简单脚本.

is a simple script demonstrating how to do it.

刚刚意识到这依赖于Carbon,所以可能并不理想...取决于您使用它的目的.

Just realised this relies on Carbon, so might not be ideal... depends a bit what you're using it for.

这篇关于python可以将文本发送到Mac剪贴板吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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