introspection and union in python



Hi,
I'm trying to use pygtk to build a gkt application. I've problems using 
binding sets.
I've simplified by problem to this sample program:
http://pastebin.com/XQ1CADBZ

Basically, I'm creating a widget class which inherits another widget class. 
Say for example, a TextView. Then, I want to capture some key events on them 
(for example, a ctrl+, ctrl-).

To add the key bindings, I discovered I couldn't use binding_entry_add_signal 
with introspection. So, I use binding_entry_add_signall and binding_set_find 
to get widgets for my textview. Gtk.binding_set_find("MyTextView") returns 
null, and as I cannot gtk_binding_set_by_class("MyTextView") with 
introspection, I use Gtk.binding_set_find("GtkTextView").
Can you confirm this is the correct way to do ?

Now, real problem I encounter is with binding_args argument.
I use
arg = Gtk.BindingArg()
arg.arg_type = gobject.TYPE_LONG
arg.long_data = 1

but in my callback, I get some random value.
I also tried, without success:
arg.d = {'long_data': 1}

So, how to represent an union in python g-introspection ?

thanks
arno



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]