when I loop through a list of menu's and list of menuItem labels, menuItems only show up in the second menu, twice. my code looks like:
import pymel.core as pm
pm.window('aim_window')
pm.columnLayout()
aim_mnu = pm.optionMenuGrp(l = 'set aim axis:')
up_mnu = pm.optionMenuGrp(l = 'set up axis:')
axes = ['pX', 'pY', 'pZ', 'nX', 'nY', 'nZ']
for mnu in [aim_mnu, up_mnu]:
pm.setParent(mnu)
for ax in axes:
pm.menuItem(l = ax)
pm.showWindow('aim_window')
the aim_mnu is empty (it's also empty if I reverse the order in the for statement) and I get double menuItems in the up_mnu. why is that?
if I explicitly tell the menuItem's parent to be a specific menu I get an error of
# RuntimeError: Menu Item's menu not found. #
so that's not a work around
ok so for setting the parent to an optionMenuGrp, one has to add the string '|OptionMenu' after the name of the optionMenuGrp so
should look like