Mel - Maya Embedded Language

Buttons are pretty easy to understand. You click the button, something happens. To see a full list of options associated with buttons consult the maya help menu.

-buttons
//create a list of buttons.

if (`window -exists myButtons`)
{
deleteUI myButtons;
windowPref -remove myButtons;
}

    window -widthHeight 155 175 myButtons;
    columnLayout -columnWidth 250 -rowSpacing 10 -columnOffset "left" 25;
    	button -label "Default" -width 100;
    	button -label "Left"   -align "left" -width 100;
    	button -label "Centre" -align "center" -width 100;
    	button -label "Right"  -align "right" -width 100;
    showWindow myButtons;
-radioButtonGrp
//radio button groups that arelinked together.
//click the button to print out its color

string $window = `window`;
	columnLayout;
	string $group1 = `radioButtonGrp 
		-numberOfRadioButtons 3
		-label "Colors" 
		-labelArray3 "Red" "Blue" "Green"
		-on1 "doWrite(0)"
		-on2 "doWrite(1)"
		-on3 "doWrite(2)"`;			
	radioButtonGrp -numberOfRadioButtons 3 
		-shareCollection $group1
		-label "" -labelArray3 "Yellow" "Orange" "Purple"
		-on1 "doWrite(3)"
		-on2 "doWrite(4)"
		-on3 "doWrite(5)";	
showWindow $window;

proc doWrite(int $color)
{
	//the value you put into the doWrite() corrilates to this array
	string $mycolor[] ={"Red","Blue","Green","Yellow","Orange","Purple"};
	print ("\nDuuude, my intuition says you clicked  the color "+$mycolor[$color]);
}
-iconTextButton
//Make an image a button.

string $window = `window`;
    columnLayout -adjustableColumn true;
    iconTextButton -style "textOnly"
    	-image1 "sphere.xpm" -label "sphere";
    iconTextButton -style "iconOnly"
    	-image1 "spotlight.xpm" -label "spotlight";
    iconTextButton -style "iconAndTextHorizontal"
    	-image1 "cone.xpm" -label "cone";
    iconTextButton -style "iconAndTextVertical"
    	-image1 "cube.xpm" -label "cube" -c "polyCube";
showWindow $window;
<Top>