Thanks for the help guys! It also seems as if I call: 

testMenu = menubar.addMenu("Test Menu") 

a second time, it doesn't recreate the menu, but returns a Menu object I can 
add commands to. 

Thanks again, 

Jake 

----- Original Message -----

| From: "Frank Rueter|OHUfx" <fr...@ohufx.com>
| To: nuke-python@support.thefoundry.co.uk
| Sent: Thursday, April 17, 2014 10:57:28 PM
| Subject: Re: [Nuke-python] menu and menuitem

| 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
| 
| --

| ohufxLogo 50x50       vfx compositing | workflow customisation and
| consulting
| _______________________________________________
| 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