Thread: Python, adding icon to new toolbar sub menu?

Reply to Thread
Results 1 to 3 of 3
  1. #1 Python, adding icon to new toolbar sub menu? 
    Hi,

    I was wondering if anyone could help me with adding an icon to a custom sub menu in menu.py.

    My code is:

    m = sphereToolBar.addMenu("customTools", "customTools.png")
    m.addCommand("Draw/AspectGuide", "nuke.createNode(\"AspectGuide\")", icon="AspectGuide.png")

    This I understand:
    First line defines the new menu (customTools) on my custom toolbar (sphereToolBar) and adds the 'customTools.png' icon to it.
    The second line makes a sub menu (Draw) under 'customTools' and adds the gizmo AspectGuide to it. The Gizmo also has a .png file associated to give the gizmo an icon.

    My question is, how do I add an icon to my sub menu? In my case 'Draw'.

    Any help would be greatly appreciated.

    Matt

    ps. is there also any way of increasing the size of the menu overall. As an example in the standard Nuke 3D menu the icon / spacing is bigger in the main menu than the 'geometry' sub folder. Just wondered. Really enjoying getting a better understanding of Nuke UI customisation.
    Reply With Quote  

  2. #2  
    Join Date
    Jan 2009
    Posts
    52
    Hey Matt,

    it's actually very simple. Just like how you defined your menu "CustomTools" and associated an icon to it you need to define what the new sub menu is going to be and assign an icon to it.

    so using your code:
    m = sphereToolBar.addMenu("customTools", "customTools.png")
    m.addCommand("Draw/AspectGuide", "nuke.createNode(\"AspectGuide\")", icon="AspectGuide.png")

    to add an icon to " Draw" you will need to add the following:

    m = sphereToolBar.addMenu("customTools", "customTools.png")
    ma = sphereToolBar.addMenu("customTools/Draw", icon = "Draw.png")
    m.addCommand("Draw/AspectGuide", "nuke.createNode(\"AspectGuide\")", icon="AspectGuide.png")


    As for the spacing between sub menu and normal menu it is my understanding that the way the GUI is made the sub menu will always have smaller icons than the main menu. I'm sure you could modify it but to be honest I really dont know that many people that use the side menu; Everyone usually use the "TAB" function or the right click on the Node Graph, as it's much easier to access and faster to work with.

    Hope that helped.

    Cheers,
    Farhad
    Last edited by minkey; March 6th, 2010 at 04:19 PM.
    Reply With Quote  

  3. #3  
    Hi Farhad,

    Thank you so much for your help, this is just what I'm looking for.

    I'm organising a bunch of gizmos and this is going to be a real help.

    Many thanks for your time.

    Matt
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	nuke.jpg‎
Views:	166
Size:	207.4 KB
ID:	9272  
    Last edited by mattdleonard; March 6th, 2010 at 04:59 PM.
    Reply With Quote  

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. cmiVFX Launches New Introduction to PYTHON Scripting Video
    By maynard in forum Programming & Development
    Replies: 3
    Last Post: October 13th, 2012, 04:05 AM
  2. Nuke 5.1 v1 Released
    By shot_grable in forum NUKE from The Foundry
    Replies: 36
    Last Post: July 17th, 2010, 01:33 AM
  3. inserting of phython script to toolbar :)
    By lamakaha in forum NUKE from The Foundry
    Replies: 0
    Last Post: June 26th, 2009, 03:06 PM
  4. Making use of Menu Objects?
    By suredosan in forum Nuke Plugins & Scripts
    Replies: 0
    Last Post: January 26th, 2009, 07:02 PM
  5. Adding a Nuke .nk files to a menu in the toolbar...
    By mattdleonard in forum NUKE from The Foundry
    Replies: 9
    Last Post: June 14th, 2008, 11:38 AM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts