[pygtk] I must be missing something - can't get label of a menu item

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Tue Oct 19 17:54:21 WST 2004


Seg, 2004-10-18 às 15:44 -0300, Christian Robottom Reis escreveu:
> On Mon, Oct 18, 2004 at 07:15:32PM +0100, Gustavo J. A. M. Carneiro wrote:
> >   It's just that you have to get the selected menu item first, only then
> > get_data.  It forces you to understand the internal structure of the
> > option menu to get to the selected menu item.  
> 
> Well, isn't it just a matter of doing:
> 
>     optionmenu.get_menu().get_active() 

So you prefer:
	optionmenu.get_menu().get_active().get_data("foobar")

I prefer:
	foobar[optionmenu.get_history()]

  Mine is shorter! :)

  And a shared data structure is good.  You can even use that to build
the option menu.  And you'll have anyways most of the times if you value
gui / main code separation in your program.

  Best regards.

> 
> -- ?
> 
> I tend to find using that a lot more straightforward than using
> get_history() to get the index and then depend on a shared data
> structure (which may or may not be available where you need it).
> 
> Take care,
> --
> Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3086 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20041019/90b1be69/smime.bin


More information about the pygtk mailing list