sub chg_btn { my ($context, ...) = @_; $btn1->configure(-background => "green", -foreground => "black") if !$context->{sensorOn}; }