Creating a custom UI inside Maya with python

blur959 blur959 at
Mon Aug 9 16:24:36 CEST 2010

Hi, all, I wonder if my post is relevant here, but i will still post
it anyway. I am working on creating a custom UI inside Maya and I
encountered some problems. Firstly, I am trying to create a textfield
button that creates a locator-shaped curve based on the coordinates
the user keyed into the text field. However I got no idea how to go
about doing it properly. I hope you guys could give me some help.
Thanks. I attached my code below. My code isn't working though. I have
this error, which says button2 is not defined. I got no clue on how
else to debug.

import maya.cmds as cmds

def createMyLayout():
    window = cmds.window(widthHeight=(1000, 600), title="test",
    cmds.rowLayout("button1, button2, button3", numberOfColumns=5)

    cmds.columnLayout(adjustableColumn=True, columnAlign="center",

    button2 = cmds.textFieldButtonGrp(label="LocatorCurve",
                                        text="Please key in your



def locator_curve(*args):
    # Coordinates of the locator-shaped curve.
    crv = cmds.curve(degree=1,
                     point=[(1, 0, 0),
                            (-1, 0, 0),
                            (0, 0, 0),
                            (0, 1, 0),
                            (0, -1, 0),
                            (0, 0, 0),
                            (0, 0, 1),
                            (0, 0, -1),
                            (0, 0, 0)])

    return crv

def edit_curve(*args):
    parts = button2.split(",")
    print parts
    x = parts[0]
    y = parts[1]
    z = parts[2]


More information about the Python-list mailing list