#!/usr/bin/perl -w use strict; use Wx; # # Wx::Frame mit einem Button erweitern # package MyFrame; use base qw(Wx::Frame); sub new { my $class = shift; my $self = $class->SUPER::new(@_); # Then define a Panel to put the button on my $panel = Wx::Panel->new( $self, # parent -1 # id ); $self->{btn} = Wx::Button->new( $panel, # parent 1, # id " Drück mich ", # label [50,20] # position ); return $self; } # # Wx::App mit unserer Button - Klasse erweitern # package ButtonClass; use base qw(Wx::App); sub OnInit { my $self = shift; my $frame = MyFrame->new( undef, -1, 'Button - Klasse', [-1,-1], [200, 100] ); $self->SetTopWindow($frame); $frame->Show(1); } # # Hauptprogramm # package main; my $wxobj = ButtonClass->new(); $wxobj->MainLoop;