I see. It won't be defined within the context of the button when you execute
it.
You should probably set the command of your PyScript knob with the contents
of your your stringKnob beforehand:
Something like:
import nukescripts
class testPanel( nukescripts.PythonPanel ):
def __init__( self ):
nukescripts.PythonPanel.__init__( self, 'testing' )
self.textKnob = nuke.String_Knob( 'message', 'Enter message:')
self.pyKnob =nuke.PyScript_Knob( 'execute' )
self.addKnob(self.textKnob)
self.addKnob(self.pyKnob)
def knobChanged(self,k):
if k == self.textKnob:
self.pyKnob.setCommand("nuke.message('%s')" %k.value())
test = testPanel().showModalDialog()
On Mon, Oct 3, 2011 at 12:09 PM, woei lee <[email protected]> wrote:
> Yes I tried doing that, but since I'm trying to set a new Command on the
> PyScript knob,
> self.playContact_knob.setCommand(".....self.stringKnob.value().....")
> doesn't work because when this Python button execute,
> it would give me syntax error on name 'self' is not defined.
>
>
>
>
>
>
> On Mon, Oct 3, 2011 at 11:56 AM, Ivan Busquets <[email protected]>wrote:
>
>> Try keeping the knob object when you create your String knob...
>>
>> self.stringKnob = nuke.String_Knob(....)
>>
>> and then just use that object later on
>>
>> self.stringKnob.value()
>>
>>
>>
>> On Mon, Oct 3, 2011 at 11:47 AM, woei lee <[email protected]> wrote:
>>
>>> I added a PyScript_Knob on PythonPanel,
>>> and I needed to setCommand on this PyScript_Knob on certain KnobChanged
>>> on a String_Knob, an use the value from that String_knob,
>>> can we do n=thisNode()['thatStringknob'].value() on PythonPanel?
>>>
>>> this is the error I got so far
>>> TypeError: 'PanelNode' object is unsubscriptable
>>>
>>> Woei
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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