Skip to content

Instantly share code, notes, and snippets.

@kaptankereviz
Created September 12, 2014 14:12
Show Gist options
  • Save kaptankereviz/1a7efd40d3b15fafe54e to your computer and use it in GitHub Desktop.
Save kaptankereviz/1a7efd40d3b15fafe54e to your computer and use it in GitHub Desktop.

Revisions

  1. kaptankereviz created this gist Sep 12, 2014.
    41 changes: 41 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    import maya.cmds as mc

    class SimpleUI(object):
    def __init__(self, *args):
    self.wg={}
    self.wg['win'] = 'MySimpleWindow'
    self.wg['dock'] = 'MySimpleDock'

    if mc.dockControl(self.wg['dock'], exists=True):
    mc.deleteUI(self.wg['dock'])
    # window
    mc.window(self.wg['win'])
    # layout
    mc.rowColumnLayout(nc=1)
    """ controls """
    mc.button(l='textField_button',
    c=self.com_button_command)
    # this works
    self.wg['textField'] = mc.textField()
    mc.button(l='textFieldGrp_button',
    c=self.com_grp_button_command)
    # this does not work
    self.wg['textFieldGrp'] = mc.textFieldGrp()
    mc.dockControl(self.wg['dock'],
    area='left',
    content=self.wg['win'])

    def com_button_command(self, *args):
    # this works
    mc.textField(self.wg['textField'], e=True, tx='blabla')

    def com_grp_button_command(self, *args):
    # this does not work
    mc.textFieldGrp(self.wg['textFieldGrp'], e=True, tx='blabla')

    SimpleUI()


    """Error Code"""
    # // Error: RuntimeError: file <maya console> line 36:
    # Object 'MySimpleWindow|rowColumnLayout10|textFieldGrp26' not found. //