i would do it this stateful handler way, i don't like passing handlers as strings, they cause lots of problems when you start packaging/namespacing your code and some defined methods are not available in __main__ namespace (where string-based
handlers execute).

import maya.cmds as cmds

class SphereClickHandler:
   def __init__(self):
       self.sphere = None
def create(self,*args):
       self.sphere = cmds.sphere();
def delete(self,*args):
       if self.sphere is None:
           return
cmds.delete(self.sphere)
       self.sphere = None


cmds.window()
cmds.columnLayout( adjustableColumn=True )
handler = SphereClickHandler()
cmds.checkBox( label='teste',align='left', onc=handler.create,ofc=handler.delete)
cmds.showWindow()

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to