Again, thanks to those trying to help with this problem. I think I finally figured out how to call wxPerl DrawPolygon. Here's what I came up with:
# This code in file main.pl. #!/usr/bin/perl package MyApp; use warnings; use strict; use Wx; use AppFrame; use vars qw( @ISA ); our @ISA = qw( Wx::App ); sub OnInit { my $self = shift; # Create new main application frame. my $frame = AppFrame->new( "Test DrawPolygon", Wx::Point->new( 50, + 50 ), Wx::Size->new( 640, 480 ) ); $frame->SetBackgroundColour( Wx::wxBLUE ); $self->SetTopWindow( $frame ); $frame->Center(); $frame->Show( 1 ); return 1; } package main; my( $app ) = MyApp->new(); $app->MainLoop(); # This code in file AppFrame.pm. #!/usr/bin/perl package AppFrame; use warnings; use strict; use Wx; use MyCanvas; our ( @ISA ) = qw( Wx::Frame ); sub new { my $class = shift; $class = ref( $class ) || $class; my ( $title, $pos, $size ) = @_; $title = defined( $title ) ? $title : "wxPerl"; $pos = defined( $pos ) ? $pos : Wx::Point->new( 0, 0 ); $size = defined( $size ) ? $size : Wx::Size->new( 50, 50 ); my $self = $class->SUPER::new( undef, -1, $title, $pos, $size ); bless( $self, $class ); # Create canvas. $self->{CANVAS} = MyCanvas->new( $self, -1, $pos, $size ); return $self; } return 1; # This code in file MyCanvas.pm. #!/usr/bin perl package MyCanvas; use warnings; use strict; use Wx; our ( @ISA ) = qw( Wx::Panel ); sub new { my ($class, $parent, $id, $pos, $size) = @_; $class = ref( $class ) || $class; $id = defined( $id ) ? $id : -1; $pos = defined( $pos ) ? $pos : Wx::wxDefaultPosition; $size = defined( $size ) ? $size : Wx::wxDefaultSize; my $self = $class->SUPER::new( $parent, $id, $pos, $size ); bless( $self, $class ); $self->SetBackgroundColour( Wx::wxBLUE ); use Wx::Event qw( EVT_PAINT ); EVT_PAINT( $self, \&on_paint ); return $self; } use Wx qw( wxGREEN_PEN wxGREEN_BRUSH ); sub on_paint { my ($self, $event) = @_; my $dc = Wx::PaintDC->new( $self ); $dc->SetPen( wxGREEN_PEN ); $dc->SetBrush( wxGREEN_BRUSH ); $dc->DrawPolygon( [ Wx::Point->new(319, 239), Wx::Point->new(311, +236), Wx::Point->new(311, 242) ], 0, 0 ); } return 1;

In reply to Re^2: wxPerl DrawPolygon by bkv2k
in thread wxPerl DrawPolygon by bkv2k

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.