问题
I am a newbie of glade/pygtk.
I am doing with some radio menu items. I created a signal handler on the signals tab,
handler: on_group_menu_change
user data: 7
what I expected is pass the int(or str) value 7 as user param to the handler. However, at startup, I found such warning:
Could not lookup object 0 on signal group_changed of object radiomenuitem1
I know gtkBuilder treat 7 as an object reference.
So how can I just pass an int/str to the handler ?
回答1:
It seems this is still on the Glade/GtkBuilder todo-list: http://live.gnome.org/Glade/Roadmap/RealUsableSignals
Currently you can only pass references to objects that you define in your xml.
Edit: Since gtk+3, the devs have broken more than just the API... The archived link above is: https://web.archive.org/web/20100510072526/http://live.gnome.org/Glade/Roadmap/RealUsableSignals
来源:https://stackoverflow.com/questions/4008309/passing-user-data-with-glade-gtkbuilder