Re: Images and preview

Johan Vromans <[email protected]> Fri, 6 Sep 2024 19:29:05 +0200
Newsgroups gmane.comp.python.wxglade
Organization Squirrel Consultancy
Message-ID <[email protected]>
On Thu, 5 Sep 2024 18:39:25 +0200, Dietmar Schwertberger
<[email protected]> wrote:

> https://wxglade.sourceforge.net/docs/bitmaps.html#customizing-bitmap-loading

Just in case a Perl user needs it:

# Override Wx::Bitmap to use resource search.
my $wxbitmapnew = \&Wx::Bitmap::new;
no warnings 'redefine';
*Wx::Bitmap::new = sub {
    # Only handle Wx::Bitmap->new(file, type) case.
    goto &$wxbitmapnew if @_ != 3 || -f $_[1];
    my ($self, @rest) = @_;
    $rest[0] = ... find the resource using $rest[0] ...;
    $wxbitmapnew->( $self, @rest );
};
use warnings 'redefine';

-- Johan