in reply to Perl Tk - Change button state based on event

I guess at this point, i am after some ideas as to how i could trigger an event only when both entry widgets have text in them. This event would change the state of the button.

Here is a way, polling

#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit; my $bu = $mw -> Button(-text => "OK", -state=>'disabled')->pack(); my @te ; push @te, $mw->Entry()->pack; push @te, $mw->Entry()->pack; $mw->repeat( 900, sub { my $state = $bu->cget('-state') ; my $both = @te == grep { $_->index('end') } @te; if( $state ne 'normal' and $both ){ $bu->configure( -state => 'normal' ); } elsif( not $both ){ $bu->configure( -state => 'disabled' ); } }, ); MainLoop;
About every second, it checks to see if both Entry widgets have a text length greater than zero, and disables/enables the button