根据用户选择替换UI元素

时间:2016-05-05 21:35:01

标签: python maya

我正在尝试创建一个将根据用户选择的内容进行更新的UI。我最初的想法是删除UI元素(如果它存在)并将其替换为带有新元素的新元素。我已经四处寻找答案,如果那里有一个,我太新了,无法理解。 我有一个包含文本滚动列表的框架布局。当在该列表中选择某些内容时,将调用一个函数来创建填充控件的UI部分。我收到错误" NameError:name' columnLayout'未定义"。 这是我遇到问题的代码的一部分:

if columnLayout(button_layout,exists = True):
    cmds.deleteUI(button_layout)
button_layout = 'button_layout'
ui_elements['column'] = cmds.columnLayout(button_layout)
ui_elements['buttons1']= cmds.button()
ui_elements['buttons2']=cmds.button()
ui_elements['buttons3']=cmds.button()

cmds.formLayout( ui_elements['form_layout'], edit=True, attachForm=[(ui_elements['column'], 'top', 5), (ui_elements['column'], 'right', 20) ] )

cmds.showWindow( window )

ui_elements [' form_layout']在上一个函数中创建。我非常感谢你的任何帮助

1 个答案:

答案 0 :(得分:0)

您已在第一行cmds前面的columnLayout停止了