How can I remove the menu item from the main window using Python? I have it working using MEL but I need it in Python as well.
The part that isn't working is the find menu if exists and delete
. I can't seem to find the equivalent in Python.
Python (not working)
import maya.cmds as cmds
if(???)
{
#cmds.deleteUI('JokerMartini', menu=True )
}
cmds.menu(label='JokerMartini', tearOff=True, p='MayaWindow')
cmds.menuItem(label='Action 1', c= 'something.run()')
cmds.menuItem(divider=True)
cmds.menuItem(label='Action 2', c= 'something.run()')
Mel (working)
if(`menu -exists JokerMartini`)
{
deleteUI JokerMartini;
}
global string $gMainWindow;
setParent $gMainWindow;
menu -label "JokerMartini" -to true -aob true JokerMartini;
menuItem -label "Action 1" -command "something";
menuItem -label "Rename..." -command "something";