Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Features/GTK3/Porting
(view source)
Revision as of 10:52, 12 July 2012
849 bytes added
,
10:52, 12 July 2012
→Tips to Activity Developers
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===
Walter
Bureaucrats
,
Administrators
10,533
edits