开发者

Passing user data with glade/gtkbuilder

开发者 https://www.devze.com 2023-01-20 23:27 出处:网络
I am a newbie of glade/pygtk. I am doing with some radio menu items. I created a signal handler on the signals tab,

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 gtk开发者_JAVA百科Builder treat 7 as an object reference.

So how can I just pass an int/str to the handler ?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消