Changes

Jump to navigation Jump to search
Line 193: Line 193:     
== Tips to Activity Developers ==
 
== Tips to Activity Developers ==
 +
 +
===Changes to the Clipboard===
 +
Two things to note:
 +
1. You need to specify a clipboard using get()
 +
    clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
 +
2. You need to pass a length to set_text()
 +
    clipboard.set_text(string, len(string))
 +
 +
See [http://python-gtk-3-tutorial.readthedocs.org/en/latest/clipboard.html] for more details.
 +
 +
===Changes to Drag-and-Drop===
 +
Slightly different syntax:
 +
        self.window.drag_dest_set(Gtk.DestDefaults.ALL, [],
 +
                                  Gdk.DragAction.COPY)
 +
        self.window.drag_dest_set_target_list(None)
 +
        self.window.drag_dest_add_text_targets()
 +
        self.window.connect('drag_data_received', self._drag_data_received)
 +
 +
and:
 +
        data.get_text()
 +
or:
 +
        data.get_image()
 +
 +
See [http://python-gtk-3-tutorial.readthedocs.org/en/latest/drag_and_drop.html] for more details.
    
===Going from Drawable to Cairo===
 
===Going from Drawable to Cairo===

Navigation menu