Iconmask, Icon, Inline

D

dgoodmaniii

I tried posting this on comp.lang.perl.tk, but haven't
gotten an answer for a week or so, so I thought I'd try
here.

I'm developing a perl/tk frontend for a small C application
I wrote (an infix frontend for a command-line postfix
calculator), and I want to distribute the perl/tk as a
standalone file without having to package it with the images
it includes.

So I converted the image to xbm, then read it into the perl
source file, assigning it to a variable like so:

my $icondata = qq(*contents of xbm file*);
my $iconmaskdata = qq(*contents of mask file, also xbm*);

I then attempt to use the icon and iconmask methods, like
so:

my $icon = $mw->Bitmap(-data=>$icondata);
my $iconmask = $mw->Bitmap(-data=>$iconmaskdata);
$mw->iconimage($icon);
$mw->iconmask($iconmask);

The "icon" works; I got the blob of black due to the
transparency not working as expected. But execution fails
with the iconmask statement included; I get the following
error:

bitmap "image1" not defined at /usr/lib/perl5/Tk/Submethods.pm line 37.

Checking line 37 of that file didn't elucidate things for
me. When I print the value of $iconmask, I get
"Tk::Bitmap=HASH(0x943ef58)", which is the same sort of
thing I get for $icon.

Using the file I imported into $iconmaskdata with
"$mw->iconmask('@logo_shapes_mask.xbm');" works perfectly
as expected, even when the icon is still the imported
variable rather than the file.

Can anyone tell me why "$mw->iconimage($icon)" works but
"$mw->iconmask($iconmask)" doesn't, when I'm using the
identical assignments for each?

Also, why does using the mask file directly work, while
using the identical data in a variable not work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top