[pygtk] handling selection-request-event

Xavier Toth txtoth at gmail.com
Sat Mar 7 23:42:56 WST 2009


I'm trying to do graphics copy/paste and have written some code to
handle selection-request-event and selection-get but it doesn't work.
I've added targets and connected handlers:
              convwindow.selection_add_target("CLIPBOARD", "image/png", 4)
              convwindow.selection_add_target("CLIPBOARD", "image/bmp", 3)
              convwindow.selection_add_target("CLIPBOARD",
"_RDESKTOP_CLIPBOARD_FORMATS", 2)
              convwindow.selection_add_target("CLIPBOARD",
"_RDESKTOP_NATIVE", 5)
              convwindow.selection_add_target("CLIPBOARD", "UTF8_STRING", 6)
              convwindow.connect('selection-request-event',
self.on_selection_request)
              convwindow.connect("selection-get", self.selection_handler)

In the selection-request-event handler I'm not processing TARGETS
request simply returning False. Is this right or do I need to change
the property and call gtk.gdk.selection_send_notify myself? If anyone
has a working example I'd really like to see it.

Ted


More information about the pygtk mailing list