Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Iconmask, Icon, Inline

34 views
Skip to first unread message

dgood...@gmail.com

unread,
Sep 5, 2012, 7:00:39 PM9/5/12
to
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?
0 new messages