Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Does anyone have any idea why this isn't working?use Wx qw(:everything); ####################################### # package MyApp; # ####################################### use strict; use vars qw(@ISA); @ISA = qw(Wx::App); sub OnInit { my($this) = @_; my($frame) = MyFrame->new( undef, -1, "Image Test", [-1,-1], [640, + 340]); $frame->CenterOnScreen; $frame->Show(1); $this->SetTopWindow($frame); return 1; } ####################################### # package MyFrame; # ####################################### use strict; use vars qw(@ISA); @ISA = qw(Wx::Frame); use Wx qw(:everything); use Wx::Event qw(:everything); use Wx::Grid; Wx::InitAllImageHandlers(); sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( @_ ); $this->{main_window} = $this; my $grid = Wx::Grid->new($this, -1, [ 10 , 70 ], [ 250, 250 ]); $grid->SetFont(Wx::Font->new(8, wxDEFAULT, wxNORMAL, wxNORMAL, 0, +"")); $grid->CreateGrid(5, 5); $grid->SetRowLabelSize(20); for (0..4) { $grid->SetColLabelValue($_, "Col $_"); } $grid->SetColLabelValue(4, "Col 5"); my $ok_image = 'C:\\Test\\check_mark.png'; $grid->SetCellValue( 3, 3, Wx::Bitmap->new("$ok_image", wxBITMAP_T +YPE_ANY)); EVT_GRID_CMD_CELL_LEFT_CLICK( $this, $grid, sub{print "Changing im +age ...\n";}); return $this; } package main; my($app) = MyApp->new(); $app->MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using an image in Wx::Grid
by Anonymous Monk on Oct 17, 2008 at 04:04 UTC |