You’re pretty much on the right track. I don’t know why what you’re doing isn’t
working, but I’m guessing it’s a scope issue of some kind.
If you define your function in an init.py/menu.py:
self.PyButton1 = nuke.PyScript_Knob('name', 'label', 'myFunction()')
If you define your function in a module that is imported by an init.py/menu.py
self.PyButton1 = nuke.PyScript_Knob('name', 'label', 'myModule.myFunction()')
Same as #2, but your module isn’t imported into the global scope yet:
self.PyButton1 = nuke.PyScript_Knob('name', 'label', 'import myModule;
myModule.myFunction()')
-Nathan
From: ae.branton
Sent: Wednesday, February 20, 2013 2:46 PM
To: [email protected]
Subject: [Nuke-python] Adding a pyscript button to a panel
Hey,
So i know how to add a pyscript button itself... something like:
self.PyButton1 = nuke.PyScript_Knob('name', 'label', 'code')
but im not sure how to get the code to work. If i have a long multiline python
code i want to attatch to this button how would i do this?
My best guess was to do
def PyButton1Function:
Py script here
and here
and so on
and call that as the third argument on nuke.PyScript_Knob('name', 'label',
'code') but i cant seem to get anything i try to work.
can someone enlighten me
--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python