ocarina/trunk/src/GuiObjects/menuItem.py

19 lines
375 B
Python

import gtk
class MenuItem(gtk.MenuItem):
def __init__(self,lbl,func,text,func2,subs):
gtk.MenuItem.__init__(self,label=lbl)
if func != None:
self.connect("activate",func,text,func2)
# If there are any submenus, add them
if subs != None:
menu = gtk.Menu()
for sub in subs:
menu.append(sub)
self.set_submenu(menu)
# Show the menu
self.show()