Passing user data with glade/gtkbuilder

独自空忆成欢 提交于 2021-01-28 04:03:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!