in reply to Html rendering with Tk::HyperText
This works:
#!/usr/bin/perl -w use strict; use warnings; use Tk; use Tk::HyperText; my $mw = MainWindow->new ( -title => 'HTML Viewer', ); my $hypertext = $mw->Scrolled ("HyperText", -scrollbars => 'e', -wrap => 'word', )->pack (-fill => 'both', -expand => 1); my $btnInsert = $mw->Button ( -text => 'insert', -command => \&insert, )->pack (-side => 'right'); MainLoop; insert(); # this insert here will only run after # the MainLoop is done. Useless use. sub insert{ # insert some HTML code # $hypertext->insert ("end","<body bgcolor=\"black\" text=\"yellow\"> +" # . "Hello, <b>world!</b></body>"); $hypertext->loadString (qq~<html> <head> <title>Hello world!</title> </head> <body bgcolor="#0099FF"> <font size="6" family="Impact" color="#FFFFFF"> <strong>Hello, world!</strong> </font> </body> </html> ~); }
|
|---|