"Eric Gillespie, Jr." wrote:
> 
> On Tue, 17 Oct 2000 16:31:49 -0600,
> Joe Van Andel <[EMAIL PROTECTED]> said:
> 
>     > Unfortunately, I don't see how to do this. Glade is
>     > creating three GtkMenuItem's associated with a GtkMenu. But
>     > how do I retrieve the GtkMenuItem for a given choice? If I
>     > could retrieve each of the GtkMenuItem's, I could attach to
>     > the 'activate' signal on each.
> 
> You can set the signal handlers in Glade just like you would for
> any other widget. You can select the menu item from the widget
> tree, or from the option menu itself.


In glade 0.5.11, I can select menu items that belong to a GtkMenu, but
not menu items on an GtkOptionMenu.  So, this approach doesn't work for
me.


> 
>     > I have attached to the 'selection-done' signal of the
>     > GtkMenu, but since I don't know the text associated with
>     > the selected GtkMenuItem, it doesn't help:
> 
> Here's a function i wrote to fill in a whole in the GTK+ API
> (which i believe has been filled for 2.0). It corresponds to
> gtk_option_menu_set_history().
> 
> def optionmenu_get_history(self):
>     menu = self.get_menu()
>     children = menu.children()
>     item = menu.get_active()
> 
>     for i in range(len(children)):
>         if children[i] == item:
>             break
> 
>     return i

Thanks - I think this approach should work, as long as I can safely
assume the children are listed in the same order as in the app.glade
file.

I appreciate your prompt reply.


-- 
Joe VanAndel              
National Center for Atmospheric Research
http://www.atd.ucar.edu/~vanandel/
Internet: [EMAIL PROTECTED]

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to