Yes, this is the easiest way to handle script buttons for PythonPanels.

-Nathan



From: mogga 
Sent: Wednesday, September 05, 2012 6:51 PM
To: nuke-python@support.thefoundry.co.uk 
Subject: [Nuke-python] Re: context of addKnob method attribute 
withinPythonPanel class

I think I found a solution using a callback... Can someone verify this is a 
reasonable way to stay within the context of the class instance?

      Code:  
      import nukescripts

      class CrazyPanel(nukescripts.PythonPanel): 
          def __init__(self, foo=None):
              nukescripts.PythonPanel.__init__( self, 'Crazy Panel', 
'net.dshng.Crazy')
              if foo is None:
                  self.some_attribute = 'Not too crazy.'
              else:
                  self.some_attribute = foo
              self.create_gui() 

          def create_gui(self):
              self.crazy_btn = nuke.PyScript_Knob('crazy_btn', 'Go Crazy')
              self.addKnob(self.crazy_btn)

          def go_crazy(self):
              nuke.message(self.some_attribute)

          def knobChanged(self, knob):
              if knob is self.crazy_btn:
                  self.go_crazy()

      CrazyPanel('BOOOOOO').showModalDialog()
     


Thanks....

Rob



--------------------------------------------------------------------------------

--
Rob Moggach
DSHNG
Dashing Collective Inc.


--------------------------------------------------------------------------------
_______________________________________________
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
_______________________________________________
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

Reply via email to