关闭GUI窗口Python MAYA

时间:2017-03-23 19:46:04

标签: python user-interface interface maya

尝试关闭窗口时似乎是一个问题。

错误:语法无效

下面是代码:

import maya.cmds as cmds

def shapeTool ():
ram = 'RenamerWin'
if cmds.window(ram, q = True, exists =True):
    cmds.deleteUI(ram)

ram = cmds.window("RenamerWin",t = "Shape Tool", w=300, h=300)
cmds.columnLayout(adj = True)
cmds.separator(h=20)
cmds.text("Welcome to the Shape Creator")
cmds.separator(h=20)


cmds.button(label='Close Window',command="cmds.deleteUI('%s')")


cmds.showWindow(ram)

shapeTool()

1 个答案:

答案 0 :(得分:3)

你错过了格式:)

cmds.button(label='Close Window',command="cmds.deleteUI('%s')" % ram)