in reply to More Perl/Tk help.
You need to tell the widget that the colour has changed. When you do $colour = 'red'; you are changing the value of the $colour variable but the widget doesn't know you have changed anything, it's not like -textvariable where any changes you make show up immediately. The -textvariable stuff does some funky magic so that it catches any updates you make to the variable. Very few other Tk parameters work like that as there is a memory and possibly performance cost associated with it.
You need to change
to$mw->Label(-textvariable => \$rightwrong, -foreground => $colour)->pack(-side=> 'bottom');
and then add something likemy $RWWidget = $mw->Label(-textvariable => \$rightwrong, -foreground => $colour)->pack(-side=> 'bottom');
into your check() subroutine.$RWWidget->configure(foreground => $colour);
|
|---|