Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w package WxBrowser::GUI; use strict; use Wx qw/:everything/; use Wx::Html; use base qw(Wx::Frame); use Wx::Event qw( EVT_BUTTON EVT_MENU); use vars qw/ %ID_ $I/; %ID_ = map { $_ => 1000 + int(rand 30) + $I++ } qw/ GOTEXT GOBUTTON HTML ABOUT QUIT GOTEXT/; sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( undef, -1, "WxBrowser - a wxPerl HTML Browser ", [0,0], [300,300], wxDEFAULT_FRAME_STYLE| wxCLIP_CHILDREN, ); $this->CreateStatusBar( 2 ); $this->SetStatusText( "Welcome to WxBrowser!", 1); $this->GOOEY(); $this->SetMenuBar( MENUU($this) ); EVT_BUTTON( $this, $ID_{GOBUTTON}, \&GONOW ); EVT_MENU( $this, $ID_{ABOUT}, \&OnAbout ); EVT_MENU( $this, $ID_{QUIT}, \&OnQuit ); return $this; } sub OnAbout { my( $this, $event ) = @_; Wx::MessageBox( "Welcome to WxBrowser 1.0 WxBrowser is a crude browser created as a demo of wxPerl Has basic support for html (probably html 1.0 or 2.0) That means, no cookies, no images, no forms, bad tables ;) (C)opyright CrazyInsomniac of PerlMonks.org. This program is released under the same terms as perl itself (if you don't know what that means, visit perl.com ) ", "About WxBrowser", wxOK|wxICON_INFORMATION, $this ); } sub OnQuit { my( $this, $event ) = @_; $this->Close(1); } sub MENUU { my( $bar ) = Wx::MenuBar->new(); my( $filemenu ) = Wx::Menu->new(); $filemenu->Append( $ID_{ABOUT}, "About", "Find Out Who Created WxB +rowser" ); $filemenu->Append( $ID_{QUIT}, "Quit", "Exit this application" ); $bar->Append( $filemenu, "File" ); return $bar; } sub GONOW { my ($this, $event) = @_; my $html = $this->FindWindow($ID_{HTML}); my $text = $this->FindWindow($ID_{GOTEXT}); $html->LoadPage($text->GetValue()); return(); } sub GOOEY{ my $parent = shift; my( $sizer1 ) = Wx::BoxSizer->new( wxVERTICAL ); my( $sizer2 ) = Wx::BoxSizer->new( wxVERTICAL ); my( $htmlsizer ) = Wx::BoxSizer->new( wxVERTICAL ); ### my( $html ) = Wx::HtmlWindow->new( ### $parent, $ID_{HTML}, wxDefaultPosition, wxDefaultSize, ); $html->SetRelatedFrame($parent, "WxBrowser: %s"); $html->SetRelatedStatusBar(0); $html->SetPage('<H1><a href="http://perlmonk.org/~grinder"><font c +olor="#be2076">W</font><font color="#b15088">a</font><font color="#a2 +8999">v</font><font color="#93bea9">e</font> <font color="#83e3b9">i< +/font><font color="#73efc7">t</font> <font color="#63e0d3">h</font><f +ont color="#54b9dd">i</font><font color="#4583e5">g</font><font color +="#374aeb">h</font><font color="#2a1cef">,</font><P><font color="#1e0 +2ef">l</font><font color="#1404ee">e</font><font color="#0c08e9">t</f +ont> <font color="#060de3">t</font><font color="#0214da">h</font><fon +t color="#001bcf">a</font><font color="#0024c2">t</font> <font color= +"#092eb3">f</font><font color="#1e38a4">r</font><font color="#3d4393" +>e</font><font color="#624f82">a</font><font color="#8a5b70">k</font> +<P><font color="#af685f">f</font><font color="#cf754e">l</font><font +color="#e5813e">a</font><font color="#ef8e2f">g</font> <font color="# +ec9a22">f</font><font color="#dda617">l</font><font color="#c2b20d">y +</font>!</a></H1>'); $htmlsizer->AddWindow( $html, 1, wxALIGN_CENTRE|wxGROW, 0 );### $sizer2->Add($htmlsizer, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 0 );## +# my( $sizer3 ) = Wx::BoxSizer->new( wxHORIZONTAL ); my( $text ) = Wx::TextCtrl->new( $parent, $ID_{GOTEXT}, "http://perlmonk.org/#jc+wrocks!", wxDefaultPosition, # [460,-1], wxDefaultSize, wxGROW # I don't even know if this works here ); $sizer3->AddWindow( $text, 1, wxGROW|wxALIGN_CENTER_HORIZONTAL, 0 +); my( $item9 ) = Wx::Button->new( $parent, $ID_{GOBUTTON}, "GO", wxDefaultPosition, [50,20], 0 ); $sizer3->AddWindow( $item9, 0, wxALIGN_RIGHT|wxALL, 0 ); ## switch these two lines, the wxBOTTOM or wxTOP don't matter $sizer1->Add( $sizer3, 0, wxGROW|wxTOP, 0 ); $sizer1->Add( $sizer2, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 0 ); $parent->SetAutoLayout( 1 ); $parent->SetSizer( $sizer1 ); } package WxBrowser; use strict; use base qw(Wx::App); use Wx qw(:everything); sub OnInit { my( $this ) = @_; my( $frame ) = new WxBrowser::GUI(); $frame->Show(1); 1; } package main; my $Browser = new WxBrowser(); $Browser->MainLoop(); __END__ =pod Run the program! =cut

In reply to WxBrowser - a wxPerl HTML Browser by crazyinsomniac

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found