#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(-title=>'Colored Text'); $mw->geometry('200x200+666+266' ); $mw->fontCreate('big', -family=>'arial', #-weight=>'bold', -size => 12 ); my $text = $mw->Scrolled('Text', -scrollbars=>'osw', -background => 'black', -foreground => 'lightyellow', -font => 'big', )->pack; #add colors and font effects $text->tagConfigure( 'tag1', -foreground => 'red' ); $text->tagConfigure( 'tag2', -foreground => 'skyblue' ); $text->tagConfigure( 'tag3', -foreground => 'yellow'); $text->tagConfigure( 'tag4', -foreground => 'green' ); $text->tagConfigure( 'bold', -font => [ 'Courier New', 20, 'bold' ] ); $text->tagConfigure( 'italic', -font => [ 'Courier New', 20, 'italic' ] ) ; # see regular text $text->insert('end',"some text\n"); # see tagged text $text->insert('end',"some text\n",'tag1'); $text->insert('end',"some text\n",'tag2'); $text->insert('end',"some text\n",['tag3','bold']); $text->insert('end',"some text\n",['tag4','italic']); MainLoop; __END__