Connecting Controls to attributes
For persistent control GUIs, it can be useful to create field and slider controls that have a direct
connection to attributes in the scene.

Consider that when you use "connectAttr" between two attributes - the connection is in one direction:
The attribute with the incoming connection will be locked and cannot be changed unless the attribute 
connected to it is changed.

Using the following controls or commands, you can create a "bi-directional" relationship between the
controls in your GUI and attributes, with any changes to one being reflected in both.

Attribute controls
Maya offers a set of convenient controls that automate the process of creating the relationship between the control and the attribute. The controls have an "-at" (or "-attribute") flag for assigning the associated attribute. attrControlGrp Automatically determines the appropriate type of control for the data type of the attribute. Not always the best choice because it will create only a field control when you might want a slider. window -title "new window" -widthHeight 420 60 myWindow; columnLayout;
attrControlGrp -a "pCube1.tx"; showWindow myWindow; attrFieldSliderGrp Creates a float field and float slider. The float field behaves like fields in the channel box, in that you can use the right mouse button to set keys or create expressions. window -title "new window" -widthHeight 420 60 myWindow; columnLayout; attrFieldSliderGrp -label "cube translateX" -min -10 -max 10 -at "pCube1.tx"; showWindow myWindow; other attribute controls include attrFieldGrp, attrColorSliderGrp, and attrNavigationControlGrp, the last one being a variation that used drag and drop, allowing the user to drop a node on the control and execute a command. See the maya command reference for more info on all the controls. Using connectControl You can set up a wider variety of controls and connect them to attributes by using the connectControl command. connectControl [flag] [controlName] [attributeName] example: window -title "new window" -widthHeight 420 60 myWindow; columnLayout; floatSliderButtonGrp -label "pCube1.tx" -min -10 -max 10 -field true -buttonLabel "key" -buttonCommand "setKeyframe pCube1.tx" myFloatSliderGrp; connectControl myFloatSliderGrp pCube1.tx; showWindow myWindow;
In some cases you may need to use the "-index" flag, to indicate which control within a group that you are making a connection: window -title "new window" -widthHeight 420 60 myWindow; columnLayout; floatFieldGrp -l "Rotation:" -numberOfFields 3 rot; // index 1 would be the text label connectControl -index 2 rot pCube1.rx; connectControl -index 3 rot pCube1.ry; connectControl -index 4 rot pCube1.rz; showWindow myWindow;