Do you have a question? Post it now! No Registration Necessary. Now with pictures!
September 16, 2012, 12:19 am
rate this thread
gotten an answer for a week or so, so I thought I'd try
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
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
my $icon = $mw->Bitmap(-data=>$icondata);
my $iconmask = $mw->Bitmap(-data=>$iconmaskdata);
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
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?