X windows and Python?
Grant Edwards
grante at visi.com
Tue Aug 15 15:59:10 EDT 2006
On 2006-08-15, Grant Edwards <grante at visi.com> wrote:
>> I'd like to program my Python script to put a string into the
>> X windows cut buffer. Can anyone suggest the simplest way to
>> do that?
>
> There isn't a simple way to do that.
I forgot to mention, there are actually three different
selections (plus the cut buffers).
Here's a nice explanation of just the selection part of the
mess:
http://www.msu.edu/~huntharo/xwin/docs/xwindows/selection.pdf
If you want something quick and dirty, you can just use
os.popen() to call xsel:
http://www.niksula.hut.fi/~vherva/xsel/
xsel doesn't do the "cut buffer" thing. It obtains ownership of
the selection, and then forks off a copy of itself to service
requests for the selection contents. I would probably have
just copied the selection to cut buffer 0 and exited, but this
way works fine.
--
Grant Edwards grante Yow! I will SHAVE and
at buy JELL-O and bring my
visi.com MARRIAGE MANUAL!!
More information about the Python-list
mailing list