-3

How to enable or disable button or change button background color by another button in maya mel. This my code so far.

global string $btn2;

global proc fun(string $btn){
    button -label "button 2" -enable false $btn;
} 
window -width 150;
columnLayout -adjustableColumn true;
    $btn1 = `button -label "button 1" -c "fun $btn2"`;
    $btn2 = `button -label "button 2" -enable true`;
showWindow;
Mahmoud Salem
  • 104
  • 1
  • 5

1 Answers1

0

Here is a code snippet that will work:

button "button_name" -edit "True" -backgroundColor "float float float" -enable "boolean";

replace button_name with the name of your button. Replace float float float with float values of the RGB color values egs. "1.0 0.0 0.0" for red.

kartikg3
  • 2,590
  • 1
  • 16
  • 23
Ari Gold
  • 1,528
  • 11
  • 18
  • Please consider giving explanations to your code, as I have editted your answer. Also please make sure your answer is properly formatted to maintain the quality of this community. – kartikg3 Feb 09 '15 at 14:29