Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Interfacing with clipboard (from Tkinter or whatever) - newbie quetion

Reply
Thread Tools

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

 
 
Porky Pig Jr
Guest
Posts: n/a
 
      06-16-2004
Hello,

this question is strictly speaking is not about Python, and even not
about Tkinter, but the general concept of clipboard. yet I've done
some searches on usenet and just didn't see the group which seemed to
be right to post this question. So it goes here. I'm reading through
'Programming Python', learning Tkinter, and got into the section which
discusses the clipboard. I'm runing Python (2.3.3) on Linux, RH 9.0
with KDE. The book only says that clipboard is 'system-wide storage
repository' and talks about Windows, and how we can exchange the data
using clipboard, even if some other program knows nothing about
Tkinter.

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?


TIA
 
Reply With Quote
 
 
 
 
Mark 'Kamikaze' Hughes
Guest
Posts: n/a
 
      06-18-2004
Porky Pig Jr <(E-Mail Removed)>
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_
 
Reply With Quote
 
 
 
 
A. Lloyd Flanagan
Guest
Posts: n/a
 
      06-22-2004
Mark 'Kamikaze' Hughes <(E-Mail Removed)> wrote in message news:<(E-Mail Removed) u>...
> Porky Pig Jr <(E-Mail Removed)>
> wrote on 16 Jun 2004 16:20:13 -0700:
> 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.
>

Actually, this is Emacs we're talking about, which means it isn't that
simple. Emacs uses its own buffer by default, but (of course) you can
customize it. In particular, there's an option "X Select Enable
Clipboard" in the customization group "Editing/Killing" which causes
emacs to use the X selection in addition to its private buffer.

If you get really ambitious, you can tell emacs which X selection to
use, but you don't want to go there if you can help it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clipboard - Copy Image To Clipboard Mahsha Javascript 1 06-01-2009 05:06 PM
$clipboard = Gtk::Clipboard.get('PRIMARY')... under windows Dan Bishop Ruby 0 08-26-2008 01:47 PM
clipboard.setContents destroys clipboard.getContents? spunibard@gmail.com Java 2 03-02-2007 07:52 PM
Paste from clipboard when clipboard changes mid script melvynm@gmail.com Javascript 4 12-14-2004 10:59 PM
Using VB.Net or C#, utilizing the clipboard object, how to copy an MS Excel graphic from the clipboard to an image control and obtain its source reference TC ASP .Net 5 09-01-2004 04:49 AM



Advertisments