I am trying to use Gtk.SelectionData.set
, for which one parameter is
data (bytes) – pointer to the data (will be copied)
The data I want to pass is a Gtk.EventBox
, but I am unclear on how to create a pointer to this data, or whether I even should. The documentation for GObject's Python bindings is automatically generated from the C documentation, and as far as I've been able to find, Python doesn't have a direct equivalent to pointers in C.
I cannot find any examples of this function being used in Python code. I've found examples in C, such as
gtk_selection_data_set (selection_data,
gdk_atom_intern_static_string ("GTK_LIST_BOX_ROW"),
32,
(const guchar *)&widget,
sizeof (gpointer));
from here, but I don't understand how to translate this to Python.
It's not going to be possible to translate that example directly to Python, because, even if you could get the address of the event box to store in the clipboard, unlike in C, you would not be able to reconstitute the event box object out of the address on the other side.
It would be hard to suggest what to do instead without knowing more about your particular application, but maybe you could store a textual representation of how to get to the widget from the top level, something like event_box.get_path().to_string()
?