在尝试调用函数时,我遇到了一些错误。我有一个按钮,当按下应该打印出来。
#code for button
cmds.button(label='FK 2 IK', command = 'Fk2Ik()', width=100)
cmds.button(label='IK 2 FK', command = Snapping.Ik2Fk(), width=100)
cmds.setParent('..')
cmds.separator(h=5, style = 'none')
cmds.separator(h=5)
#code for function
class Snapping(self):
def Ik2Fk(self):
print "Snapped"
'''
the error I get is this
# Error: TypeError: file <maya console> line 119: unbound method Ik2Fk() must be called with Snapping instance as first argument (got nothing instead) #发布于 2019-07-27 05:18:51
class Snapping(self):
@staticmethod
def Ik2Fk():
print "Snapped"
cmds.button(label='FK 2 IK', command = 'Fk2Ik()', width=100)
cmds.button(label='IK 2 FK', command = Snapping.Ik2Fk, width=100)
cmds.setParent('..')
cmds.separator(h=5, style = 'none')
cmds.separator(h=5)https://stackoverflow.com/questions/57225771
复制相似问题