pythontextpanelnuke

Adding plain text to a Nuke simple panel window


I work with Nuke all the time and I know simple Python to create simple tools in it. I’ve been able to carry out moderately complicated actions with panels and tools but I am stuck with something that should be very simple, but I can’t seem to find the answer here or in nukepedia or in the foundry help and tutorials. I want to add some simple text to my panel. For example:

p = nuke.Panel('test')
p.message('This is where I hope to display an explanation of the tool')
p.addButton('Quit')

Where I use p.message just as a placeholder for what I need.

Any help would be appreciated, I feel like this is so simple that it isn’t included in most of the documentation.


Solution

  • For windows containing a simple message use this code:

    nuke.message('Description of the tool')
    

    If you need yes/no choice, use this code:

    if nuke.ask('Would you like to create a ColorWheel node?'):
        nuke.createNode('ColorWheel')
    

    In case you need a panel, use the following code:

    panel = nuke.Panel('Test panel')
    panel.addNotepad('Description here','Description of the Tool')
    panel.addButton('Quit')
    

    ...and then just call:

    panel.show()