def populate_menu(mainmenu, section, commands, function): new_menu = SimpleMenu() section_item = MenuItem(section) section_item.set_name(section) section_item.show() section_item.set_submenu(new_menu) mainmenu.append(section_item) for command in commands: new_menu.add(command, function, section_item)
def add_menu(self, commands, name, function, radio=False): if radio: new_menu = RadioMenu(commands, function) else: new_menu = SimpleMenu() for command in commands: new_menu.add(command, function) self.menubar.append(new_menu, name)
def add_menu(self, commands, name, function): new_menu = SimpleMenu() for command in commands: new_menu.add(command, function) self.menubar.append(new_menu, name)
def make_menu(options, function, name='_none_'): menu = SimpleMenu() menu.set_name(name) for option in options: menu.add(option, function) return menu
def __make_menu__(self, options, function): menu = SimpleMenu() for option in options: menu.add(option, function) return menu
def add_menu_orig(self, commands, name, function): new_menu = SimpleMenu() for command in commands: new_menu.add(command, function) self.menubar.append(new_menu, name)