我在另一个中调用一个方法。我得到的这个脚本的错误是
NameError: name 'mnDialog' is not defined
有什么原因吗?我认为这与执行不在全局级别的命令有关。(我不认为 python 有一个全局和局部变量声明。)什么是正确的语法或绕过这个?感谢您的时间。
import maya.cmds as cmds
def mnProgRun():
def mnDialog(*args):
cmds.confirmDialog( title='Confirm', message='Are you sure?',button=['Yes','No'], defaultButton='Yes',cancelButton='No',dismissString='No' )
def mnMakeWin():
cmds.window( 'mnWin', title = 'testman', wh=(260,100))
cmds.columnLayout(adjustableColumn=False, columnAlign='center')
cmds.button( label="Yes,it works",align='center',width=120,height=25, backgroundColor=[0.5,1,0.5],command='cmds.scriptJob( event=["SelectionChanged","mnDialog"])')
cmds.button( label="No, Thank You!",align='center',width=120,height=25, backgroundColor=[1,0.5,0.5],command='cmds.deleteUI("mnWin")')
cmds.showWindow( 'mnWin' )
mnMakeWin()
mnProgRun()