hi ,guys , I want try ClassMetohd, but I don’t know why I made a mistake.thx
import maya.cmds as mc
class test(object):
def __init__(self):
name='test'
if mc.window(name,ex=True):
mc.deleteUI(name)
mc.window(name)
self.testUI()
mc.showWindow(name)
def testUI(self):
mc.columnLayout()
mc.button('test1',c='') # what shall I do?
mc.button('test2',c='self.check(V=1)') # its wrong NameError: file <maya console> line 1: name 'self' is not defined #
mc.button('test3',c=self.check) # its work,but its not I want
def check(self,V=0):
if V==1:
print 'ok'
elif V==2:
print 'not ok'
print '???'
test()