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

Discussion in 'Python' started by Porky Pig Jr, Jun 17, 2004.

  1. Porky Pig Jr

    Porky Pig Jr Guest

    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
    Porky Pig Jr, Jun 17, 2004
    #1
    1. Advertising

  2. Porky Pig Jr <>
    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_
    Mark 'Kamikaze' Hughes, Jun 18, 2004
    #2
    1. Advertising

  3. Mark 'Kamikaze' Hughes <> wrote in message news:<>...
    > Porky Pig Jr <>
    > 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. :)
    A. Lloyd Flanagan, Jun 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    764
  2. Dan Bishop
    Replies:
    0
    Views:
    230
    Dan Bishop
    Aug 26, 2008
  3. Replies:
    4
    Views:
    265
    Randy Webb
    Dec 14, 2004
  4. Mahsha

    Clipboard - Copy Image To Clipboard

    Mahsha, Jun 1, 2009, in forum: Javascript
    Replies:
    1
    Views:
    579
    Thomas 'PointedEars' Lahn
    Jun 1, 2009
  5. Mahsha

    Clipboard - Copy Text To Clipboard

    Mahsha, Jun 1, 2009, in forum: Javascript
    Replies:
    3
    Views:
    647
    Thomas 'PointedEars' Lahn
    Jun 1, 2009
Loading...

Share This Page