[pygtk] pygtk clipboard in gtk.Entry

Marcos Pinto markybob at gmail.com
Tue May 22 08:51:05 WST 2007


I'm trying to get X's clipboard contents to be automatically made the
default entry in a gtk.Entry field.  I've tried finding examples for
this, but none of them seemed to work.  Here's that part of the code:

                textview = gtk.TextView()
                textbuffer = gtk.TextBuffer(None)
                display = gtk.gdk.display_manager_get().get_default_display()
                clipboard = gtk.Clipboard(display, "CLIPBOARD")
                urlpaste = textbuffer.paste_clipboard(clipboard, None,
textview.get_editable())
                label = gtk.Label(_("Enter the URL of the .torrent to
download"))
                entry = gtk.Entry()
                entry.set_text(urlpaste)

this fails on me with:
     entry.set_text(urlpaste)
TypeError: GtkEntry.set_text() argument 1 must be string, not None

No matter what, I cant get the clipboard contents to be automatically
put into urlpaste.  Any tips at all are greatly appreciated.

Thanks all,
Marcos


More information about the pygtk mailing list