You can't have multiple colored lines (different colored lines) in a listbox (afaik), you should use the text widget and configure some tags for different colors. Below is a replacement for everything in your script starting from the text box comment (now we use text widget). This doesn't use fileevent because you are just reading from the log file itself rather than a continuous process:
##### # # Main Text Box # ##### my $text = $mw->Scrolled('Text', -relief => 'sunken', -width => 100, -height => 30, -background => 'white'); $text->pack(-side => 'left', -fill => 'both', -expand => 'yes'); $text->tagConfigure('CRITICAL', -foreground => 'red'); $text->tagConfigure('MAJOR', -foreground => 'pink'); # loop and subroutine to enter text from logfile into listbox #$mw->fileevent(LOG, 'readable', [\&insert_lines]); insert_lines(); MainLoop(); ##### # # Subroutines # ##### sub insert_lines { while(<LOG>){ if(/(CRITICAL|MAJOR)/){ $text->insert('end',$_,$1); }else{ $text->insert('end',$_); } } }
hope it helps some.
In reply to Re: TK Problem (me again)
by danger
in thread TK Problem (me again)
by locked_user mr_leisure
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |