【发布时间】:2014-01-20 06:38:04
【问题描述】:
您好,我正在学习如何使用 Python 为 Maya 创建自定义 UI。我正在努力实现一些我无法做到的事情。我四处寻找,但找不到我的答案。
import maya.cmds as cmds
def main():
cmds.window(title='Test Window')
cmds.columnLayout()
cmds.textFieldGrp('obj1', label='Name', text ="Please enter your name")
cmds.textFieldGrp('obj2', label='Address', text = "Please enter your address")
cmds.rowLayout(nc=3)
cmds.button(label="Lock", width=100, c='disable_texts()')
cmds.button(label="Edit", width=100, c='change_texts()')
cmds.button(label="Reset", width=100, c='default()')
cmds.showWindow()
def disable_texts():
# disable the text fields
def change_texts():
# enable the text fields
def default():
# change the text fields back to default ie like above
【问题讨论】:
-
问题/问题是什么?
-
发布后,您将永远无法更新文本,因为您没有在任何地方存储文本的名称。 'textFieldGroup -e obj1' 可能不起作用,因为你不能确定你在其他地方还没有'obj1'。将命令的结果捕获到变量中并使用它