Hi,
how can you select a menuitem with python code?
I want to remember the last menuitem the user took,
so that I can focus/select it the next time the menu
pops up.
something like this:
self.flagsmenu.popup(....)
if self.flagsmenu_lastitem:
self.flagsmenu_lastitem.select() # menuitem
GTK remembers the last selected item itself with the method
get_active(). Therefore, you don't need to remember it yourself. A
callback like this should do what you want.
def event_cb(menu, button_ev):
if button_ev.button == 3:
for item in menu:
item.deselect()
menu.get_active().select()
menu.popup(None, None, None, button_ev.button, button_ev.time)
--
mvh Björn
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/