that is a bit annoying but you can use simple string parsing to ship around it, e.g:

menu = nuke.menu('Nuke')

menu.addMenu('testMenu')


testMenu = menu.menu('testMenu')

menu.addCommand('%s/myNewCommand' % testMenu.name(), lambda: nuke.createNode('Blur'))






On 4/18/14, 6:44 AM, Jake Richards wrote:
Hello:
  I was trying to use to find an existing menu and add some commands to it using the .menu("") call but it appears this is returning a MenuItem object instead of a Menu, and thus I can't call addCommand on it.
Nuke 8.0v3 in Linux:

menubar = nuke.menu("Nuke")

# Result:

testMenu = menubar.addMenu("Test Menu")

# Result:

testMenu

# Result:

<Menu object at 0x1d13b10>

menubar.menu("Test Menu")

# Result:

<MenuItem object at 0x1d139d8>


Shouldn't menubar.menu("Test Menu") return a Menu object?
.findItem seems to return a MenuItem as well:

menubar.findItem("Test Menu")

# Result:

<MenuItem object at 0x1d139a8>


Even iterating through .items() gives me a menuItem.


for i in menubar.items():

if i.name() == "Test Menu":

print i

# Result:

<MenuItem object at 0x1d137b0>


Am I totally not seeing the forest through the trees on how to get a Menu object to then call addCommand?

Thank you!


Jake


--
--------------------------------------------
tru...@blueskystudios.com       203-992-6319
LTD                         Blue Sky Studios
--------------------------------------------


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to