in reply to Perl/Tk question

To grey out the "cos" button, use
$cos->configure(-state => 'disabled');
with $cos being the Tk::Button object. To be able to enable it again when cos is valid input again, you need to maintain the state of the math input in a variable.