Getting text into the copy-paste buffer...
David Hirschfield
davidh at ilm.com
Tue Sep 5 16:44:00 EDT 2006
This is good info...but I'm looking for the opposite direction: I want
to place some arbitrary command output text into the clipboard, not get
the current selection out of the clipboard.
Any help on that end?
-Dave
kdart wrote:
> David Hirschfield wrote:
>
>> Strange request, but is there any way to get text into the linux
>> copy-paste buffer from a python script ?
>>
>> I know the standard python libraries won't have that functionality
>> (except as a side-effect, perhaps?), but is there a simple trick that
>> would do it on linux? A command line to get text into the buffer? Using
>> a gui toolkit as a proxy to get text in there?
>>
>
> There's a utility called xclip that you can wrap with popen2 or
> something similar. I use my own proctools:
>
> import proctools
> XCLIP = proctools.which("xclip")
> es, arg = proctools.getstatusoutput("%s -o -selection primary" %
> (XCLIP,))
>
> "arg" has the X selection.
>
>
--
Presenting:
mediocre nebula.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060905/6fb36937/attachment.html>
More information about the Python-list
mailing list