my $sb = $mw->Spinbox( -text => 1, -validate => 'all', ); $sb->configure( -validatecommand => [sub{ my $spinbox = shift; .............. }, $sb], );