【发布时间】:2015-01-12 00:24:01
【问题描述】:
我正在尝试在 Maya 的 python 脚本的 ui 中启用/禁用浮点字段,但我不知道它是如何完成的。这是一个例子:
import maya.cmds as cmds
def createUI(windowTitle):
windowID = 'myWindoWID'
if cmds.window(windowID, exists = True):
cmds.deleteUI(windowID)
cmds.window( windowID, title = windowTitle, sizeable = False, resizeToFitChildren = True)
cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [(1,120), (2,120), (3,120)])
cmds.floatField(enable = False)
cmds.button(label = 'enable the float field', command = enableFloatField)
cmds.button(label = 'disable the float field', command = disableFloatField)
cmds.showWindow()
def enableFloatField(*args):
#enable the float field
print 'float field enabled'
def disableFloatField(*args):
#disable the float field
print 'float field disabled'
createUI('my window')
【问题讨论】:
-
非常感谢您的帮助和解释。 :)
标签: python user-interface maya