Someone on comp.lang.perl.tk asked if you could embed a browser in a Tk app. Well I know mozilla dosn't support the -xid option, but "Dillo" does. Here is an example. Dillo's big drawback is it dosn't display frames, but it gives usable links instead. Dillo
#!/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= <DIL>; $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();

In reply to embedding Dillo Html browser in a Tk app by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.