Using Tkinter's clipboard

Robert Roy rjroy at
Tue Oct 30 21:25:27 CET 2001

On 30 Oct 2001 08:21:47 -0800, johnny at (Johnny deBris)

>Hi there,
>I was wondering how to use the clipboard from Tkinter. I noticed there
>are some methods for clearing and appending to the clipboard, but none
>to retreive something from it... Is there no way at all to retreive
>data from the clipboard using Tkinter? I'm writing a small texteditor
>that has to work cross-platform, so the Tkinter-way would be a lot
>easier than using the windows-clipboard lib. If there's no way to do
>it using Tkinter, though, could you people tell me how to work with
>the clipboard in X? 'Cause I did not find anything about that either
>Thanx a bunch,
>Guido Wesdorp, Holland

It is quite simple atlhough not at all obvious. For example from an
event handler:

  def onRightClick(self, event):
    data =  event.widget.selection_get(selection="CLIPBOARD"))
    print data


More information about the Python-list mailing list