How would i write a code for my pushbutton in a gui that flips or changed the background color on the pushbutton back to original?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am creating the memory game using a gui and im using multiple pushbuttons to display the different colors. When i click on the button it does change to a different color but i need it to go back to the original color if the two cards chosen are not the same. How could i do that?
댓글 수: 0
답변 (2개)
Image Analyst
2014년 4월 18일
You'll find answers to tricky stuff like this on Yair's web site "undocumented MATLAB": http://undocumentedmatlab.com/?s=button+color
댓글 수: 0
nl2605
2014년 4월 17일
Store a variable with value 1. Then simply negate it everytime you run the callback function. And using an if-else statement you can change colours. To get the default color of pushbutton use get(handles.pushbutton,'BackgroundColor'). I hope its clear.
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!