Try this class Test( nukescripts.PythonPanel): def __init__( self ): nukescripts.PythonPanel.__init__( self, 'Test', 'my.panel') self.__addNodes = [] for i in xrange(5): self.cur_node = nuke.Boolean_Knob("colour"+str(i) ) self.addKnob(self.cur_node) #this for future if you want to find what node created. self.__addNodes.append(self.cur_node)
Test().showModalDialog() On Thu, Jun 28, 2012 at 1:57 PM, irwit <nuke-python-re...@thefoundry.co.uk>wrote: > ** > Hi all > > I'm trying to dynamically create buttons from from a list but am having > trouble with the syntax? > > *Code:* > class Test( nukescripts.PythonPanel): > > def __init__( self ): > nukescripts.PythonPanel.__init__( self, 'Test', 'my.panel') > > ### create buttons > > for i in xrange(5): > > self.test+str(i) = nuke.Boolean_Knob("colour"+str(i) ) > > # add buttons to panel > for i in rangex(5): > > self.addKnob(self.teststr(i)) > > Test().showModalDialog() > > > > This issue is the self.test+str(i) > > I cant figure out how to make this part work with str(i) ??? > > Any ideas would be a great help as this has totally stumped me? > > Many thanks > > Will > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > -- --:: Kurian ::--
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python