#!/usr/bin/perl -w use strict; use Wx; package MyFrame; use Wx; use Wx::Event qw(EVT_BUTTON); use base 'Wx::Frame'; sub new { my $ref = shift; my $self = $ref->SUPER::new( undef, # parent window -1, # ID -1 means any 'wxPerl rules', # title [-1, -1], # default position [640, 480], # size ); # controls should not be placed directly inside # a frame, use a Wx::Panel instead my $panel = Wx::Panel->new( $self, # parent window -1, # ID ); # create a button my $button = Wx::Button->new( $panel, # parent window -1, # ID 'quit', # label [30, 20], # position [-1, -1], # default size ); EVT_BUTTON( $self, $button, \&quit ); # this doesn't work, Wx::Frame doesn't have a getDC call my $dc = $self->getDC; $dc->DrawEllipse( 20, 20, 50, 50 ); return $self; } sub quit { my $self = shift; #exit(0); $self->Close(1); } package MyApp; use base 'Wx::App'; sub OnInit { my $frame = MyFrame->new; $frame->Show(1); } package main; my $app = MyApp->new; $app->MainLoop; __END__