#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); $mw->protocol('WM_DELETE_WINDOW' => sub {}); $|++; my $url = shift || ''; my $canv = $mw->Canvas(-bg => 'lightsteelblue', -relief => 'sunken', -width => 650, -height => 450, )->pack(-expand => 1, -fill => 'both'); my $contWidth = 500; my $contHeight = 400; ## this Frame is needed for including the xterm in Tk::Canvas my $Container = $canv->Frame(-container => 1); my $xtid = $Container->id(); # converting the id from HEX to decimal as xterm requires a decimal Id my ($xtId) = sprintf hex $xtid; my $dcontitem = $canv->createWindow(325,225, -window => $Container, -width => $contWidth, -height => $contHeight, -state => 'normal'); my $t = $mw->Scrolled('Text', -width => 80, -height => 10, -bg=> 'black', -fg => 'hotpink', )->pack( -expand=> 'x'); my $cframe = $mw->Frame()->pack(-expand =>'x'); my $pid ||= $$; $cframe->Button(-text => "Start", -command => sub{ $pid = open(DIL, "dillo -x $xtId $url |"); $mw->fileevent(\*DIL,'readable',sub{ my $str= ; $t->insert('end',$str); $t->see('end'); }); })->pack(-side =>'left',-padx=>5 ); $cframe->Button(-text => "Exit", -command => sub{ kill 9, $pid; close DIL; Tk::exit; } )->pack(-side=>'right' ); MainLoop();