so i kept trying and got some direction now i what i am stuck into is changing the value in text box self.name when pulldown_knob value is changed, here is what i have so far
import nukescripts
if nuke.env["gui"]:
class PromptName(nukescripts.PythonPanel):
def __init__(self, *args):
self.readNodeLst = args
nukescripts.PythonPanel.__init__( self, "Name for Backdrop", "namePrompt" )
self.name = nuke.EvalString_Knob( "name", "Name:" )
self.readNodes = nuke.Pulldown_Knob("pulldown",'nodeNames', self.retDict())
self.addKnob(self.name)
self.addKnob(self.readNodes)
#self.name.setValue("")
def retDict(self):
readNodeDict = {}
for eachReadNode in self.readNodeLst:
readNodeDict[eachReadNode] = self.setNameValue()
return readNodeDict
# The next function shows the dialog as a modal dialog. Doing this automatically adds the 'OK' and 'Cancel' buttons to the dialog.
def showModalDialog( self ):
result = nukescripts.PythonPanel.showModalDialog(self)
if result:
return self.name.value()
def setNameValue(self):
self.name.setValue(self.readNodes.value())
# The following function is called testModalPanel and tests whether the dialog works.
def testModalPanel():
obj = PromptName("Hello","Hello2")
obj.showModalDialog()
#return PromptName().showModalDialog("Hello")
# This last line calls the test function that then displays the dialog.
testModalPanel()
i keep getting error saying:
Traceback (most recent call last):
File “<string>”, line 34, in <module>
File “<string>”, line 30, in testModalPanel
File “<string>”, line 8, in init
File “<string>”, line 16, in retDict
File “<string>”, line 26, in setNameValue
AttributeError: ‘PromptName’ object has no attribute ‘readNodes’
or how should i get the value of selected item in a pull down menu…?