Interfacing with clipboard (from Tkinter or whatever) - newbie quetion

Mark 'Kamikaze' Hughes kamikaze at kuoi.asui.uidaho.edu
Fri Jun 18 16:21:48 EDT 2004


Porky Pig Jr <porky_pig_jr at my-deja.com>
wrote on 16 Jun 2004 16:20:13 -0700:
> So I've decided to give it a shot - under Linux/KDE. Ran the example
> of simple editor, simpleedit.py, which implements clipboard
> (interfacing from Tkinter), cut the text, and tried to place it into
> different applications. VIM worked fine. KDE Notepad worked fine.
> EMACS didn't work at all (seems like it's using its own clipboard?)
> so I'm a bit confused here, and may be somebody can explain where does
> clipboard lives on Unix. that is, is this a part of desktop manager
> (such as KDE), or it will work under some more generic window manager
> (such as IceWM)? Finally, does anyone know what's the story with
> Emacs?

  The clipboard is managed by X11, not the applications.  There are two
main "selections" in X11: PRIMARY and CLIPBOARD (there's an unlimited
number of named selection buffers, but all X11 apps directly support one
or both of those).  PRIMARY is filled with text when you left-drag the
mouse over it, the selection can be extended by right-clicking, and it
can be pasted by middle-clicking into a text area or terminal (like an
xterm).  CLIPBOARD is set and pasted with menu or keyboard
Cut/Copy/Paste commands.

  I don't use Emacs, but probably you selected and copied that text with
the keyboard, so it never got in PRIMARY, and Emacs only uses PRIMARY.

  There's a very useful standard tool, xclipboard, which will display
the contents of CLIPBOARD and let you clear it, switch between multiple
buffers, paste in the contents of PRIMARY, and drag over text to copy
CLIPBOARD back to PRIMARY.

-- 
 <a href="http://kuoi.asui.uidaho.edu/~kamikaze/"> Mark Hughes </a>
"The Oval Office carpet is thick with Presidential semen. They look out of the
 window, think "I own you all" and jack off like ugly apes in humping season.
 It's what they live for. No one who wants that is to be trusted. Why can't you
 all /see/ that?" -Warren Ellis, _Transmetropolitan #16_



More information about the Python-list mailing list