Example
#!/usr/bin/perl -- ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" use strict; use warnings; use Wx (); Main( @ARGV ); exit( 0 ); sub Main { GoWx(); GoWx( qw/ fa fa fa / ); } sub GoWx { my @sides = ( Wx::wxALIGN_LEFT(), Wx::wxALIGN_RIGHT(), Wx::wxALIGN_CENTRE(), ); my @stats = qw/ I cant sleep cause my bed's on fire Don't touch me I'm a real live wire /; my $app = Wx::SimpleApp->new; my $frame = Wx::Frame->new( undef, -1, @_ ? "@_" : $0 ); my $panel = Wx::Panel->new( $frame, -1, [ -1, -1 ], [ 160, -1 ] ); $frame->SetBackgroundColour( Wx::ColourDatabase::Find( 'red' ) ); $panel->SetBackgroundColour( Wx::ColourDatabase::Find( 'green' ) ) +; $frame->SetSizer( Wx::BoxSizer->new( Wx::wxHORIZONTAL() ) ); $frame->GetSizer->Add( $panel, 0, Wx::wxEXPAND(), Wx::wxALL(), 20 +); $panel->SetSizer( Wx::BoxSizer->new( Wx::wxVERTICAL() ) ); for my $word ( @stats ) { my $side = rand @sides ; my( $width, $height ); { my $autos = Wx::StaticText->new( $panel, -1, "$word:" ); ( $width, $height ) = $autos->GetSizeWH; $autos->Destroy; } my $static = Wx::StaticText->new( $panel, -1, "$word:", [-1,-1], [ $width + 10 + rand 100 ,-1], #~ $sides[ rand @sides ], $sides[ @sides - 1 - $side ], ); $static->SetBackgroundColour( colors() ); $panel->GetSizer->Add( $static, 0, $sides[ $side ], Wx::wxALL( +), 20 ); } if( @_ ) { my $pink = Wx::Panel->new( $frame, -1, [ -1, -1, ], [ 120, -1 +], ); $pink->SetBackgroundColour( Wx::ColourDatabase::Find( 'pink' ) + ); $frame->GetSizer->Add( $pink, 0, Wx::wxEXPAND(), Wx::wxALL(), +20 ); } $app->SetTopWindow( $frame ); $frame->Maximize( 1 ); $frame->Show; $app->MainLoop; } ## end sub GoWx BEGIN { my $counter = 0; my @colors = qw[ yellow orchid orange plum GOLDENROD CORAL gold ] +; sub colors { $counter = 0 if $counter >= @colors; my $color; while( 1 ) { $color = Wx::ColourDatabase::Find( $colors[ $counter++ ] ) +; return $color if defined $color and $color != Wx::wxNullCo +lour(); } } } ## end BEGIN __END__

Instead of WxPanel try naming your panel label_panel or left_label_panel ... naming your widgets/controls descriptively is important

One way of keeping track (what goes where) is naming your sizer/container elements by position, and incorporating the parent/child relationship into the name. Afterwards you incorporate your action elements (text/buttons) and name then by purpose/property/action (email_input/email_text,submit_button,cancel_button... )

I like Wx :) Re: wxPerl: is BitmapFromImage implemented? (no;sleep;docs), my wxWidgets / wxPerl / wxGlade tutorial, http://www.wxperl.it/p/wxperl-primer.html , wxperl_usage / wxperl-usage / wxPerl::Usage / Class Method Browser , available methods, method invocation syntax, link to docs, Re^8: How to use wxHtmlEasyPrinting (On debugging, verify everything, talk to teddybear ... and links and links , Tutorials: Perl documentation documentation, Searching Perl Documentation

you don't need to build wx yourself, http://www.citrusperl.com/, http://ppm.wxperl.it/

What Do These Sizer Things Do?


In reply to Re^3: wxPerl Static Text alignment by Anonymous Monk
in thread wxPerl Static Text alignment by einhverfr

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.