- or download this
my %context;
...
$button->bind('<ButtonRelease-1>' => sub{chg_btn(\%context, @_});
- or download this
sub sensorHandler {
my ($context, ...) @_;
...
$context->{sensorOn} = $data !~ /(?<![\w-])OFF(?![\w-])/i;
...
}
- or download this
sub chg_btn {
my ($context, ...) = @_;
...
$btn1->configure(-background => "green", -foreground => "black")
if !$context->{sensorOn};
}