I first thought that this question would target people who specifically know how Glade works when it generates Perl code, because I suppose this is a bug with Glade. Here goes the entire code for app.pl:

use Wx 0.15 qw[:allclasses]; use strict; 1; package main; use MyFrame8; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $frame_9 = MyFrame8->new(); $app->SetTopWindow($frame_9); $frame_9->Show(1); $app->MainLoop(); }

MyFrame8.pm is also generated by Glade and it has a bit more code that makes the frame. Still, there's no OnInit in there. The only OnInit is the one above, also generated by Glade. Here's MyFrame8.pm then:

use Wx 0.15 qw[:allclasses]; use strict; package MyFrame8; use Wx qw[:everything]; use base qw(Wx::Frame); use strict; # begin wxGlade: ::dependencies # end wxGlade sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name; # begin wxGlade: MyFrame8::new $style = wxDEFAULT_FRAME_STYLE unless defined $style; $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $sty +le, $name ); $self->{panel_1} = Wx::Panel->new($self, -1, wxDefaultPosition, wx +DefaultSize, ); $self->{label_1} = Wx::StaticText->new($self->{panel_1}, -1, "labe +l_1", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); $self->{Test} = Wx::Button->new($self->{panel_1}, -1, "Test"); $self->__set_properties(); $self->__do_layout(); # end wxGlade return $self; } sub __set_properties { my $self = shift; # begin wxGlade: MyFrame8::__set_properties $self->SetTitle("frame_9"); $self->SetSize(Wx::Size->new(400, 300)); # end wxGlade } sub __do_layout { my $self = shift; # begin wxGlade: MyFrame8::__do_layout $self->{sizer_9} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_10} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_11} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_10}->Add($self->{label_1}, 1, wxALIGN_CENTER_HORIZON +TAL, 0); $self->{sizer_11}->Add(0, 78, 0, wxADJUST_MINSIZE, 0); $self->{sizer_11}->Add($self->{Test}, 0, wxALIGN_CENTER_HORIZONTAL +, 0); $self->{sizer_10}->Add($self->{sizer_11}, 1, wxALL|wxEXPAND, 0); $self->{panel_1}->SetAutoLayout(1); $self->{panel_1}->SetSizer($self->{sizer_10}); $self->{sizer_10}->Fit($self->{panel_1}); $self->{sizer_10}->SetSizeHints($self->{panel_1}); $self->{sizer_9}->Add($self->{panel_1}, 1, wxEXPAND, 0); $self->SetAutoLayout(1); $self->SetSizer($self->{sizer_9}); $self->Layout(); # end wxGlade } # end of class MyFrame8 1;


In reply to Re^2: WxPerl and Glade: Wx::App::OnInit redefined by carcassonne
in thread WxPerl and Glade: Wx::App::OnInit redefined by carcassonne

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.