Leser: 3
![]() |
|< 1 2 >| | ![]() |
16 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#!/usr/bin/perl use strict; use warnings; use Tk::Text; use Tk; my $mw = tkinit; my $text = $mw->Text()->pack; my $line = 0; while( my $inhalt = <DATA> ){ $text->insert('end',$inhalt ); ++$line; if( $inhalt =~ /^Fehler:/ ){ $text->tagAdd('red_text',$line . ".0" , $line . "." . length $inhalt); $text->tagConfigure('red_text', -foreground => 'red'); } } MainLoop; __DATA__ Dies ist ein Test! Fehler: Laeuft nicht Eine Zeile dazwischen. Noch eine Zeile Fehler: fehlerhafte Zeile Fehler: noch ein Fehler Alles ok!
'end -1 lines'
'end -1 lines'
1
2
3
4
5
$text->insert('end',"Dies ist ein roter Test\n");
$text->tagAdd('red_text',"1.13","1.18");
$text->insert('end',"Dies ist ein blauer Test\n");
$text->tagAdd('blue_text',und was hier???);
1
2
3
4
5
6
7
8
9
10
11
use Tk;
$top = new MainWindow;
$t = $top->ROText->pack;
$t->tagConfigure('blue_text', -foreground => 'blue');
for (@INC) {
$t->insert("end", "<$_>\n");
}
$t->tagAdd('blue_text', 'end -2 lines', 'end - 1 chars');
MainLoop;
![]() |
|< 1 2 >| | ![]() |
16 Einträge, 2 Seiten |