RE: How to access a bitmap object after defining it with DefineBitmap?

"Jack" <[email protected]> Thu, 15 Jul 2010 18:43:08 -0600
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
My apologies for the top-post.

If you consider changing your method of defining a bitmap then you can
access and change the object. Here is a sample:

###############################
use strict;
use warnings;

use Tk;
use Tk::Bitmap;

my $top = MainWindow->new();
my $anchorbits = qq(
#define anchor.xbm_width 16
#define anchor.xbm_height 16
static char anchor.xbm_bits[] = {
   0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x80, 0x05, 0x80, 0x05, 0x80, 0x05,
   0x80, 0x03, 0x80, 0x01, 0x9e, 0x79, 0x8e, 0x71, 0x8e, 0x71, 0x8a, 0x51,
   0x90, 0x09, 0xe0, 0x07, 0x80, 0x01, 0x00, 0x00};
);

my $bitmap = $top->Bitmap('anchor',-data=>$anchorbits);
my $button = $top->Button(-image=>'anchor')->pack();

#Turn background of bitmap to a red after 5 seconds..
$top->after(5000,sub {
$bitmap->configure(-background=>'red');});

MainLoop(); 
__END__
###############################

Jack..

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Craig Votava
Sent: July-15-10 8:20 AM
To: PerlTk List
Subject: How to access a bitmap object after defining it with DefineBitmap?

Folks-

Given the attached program, how can I access the 'arrowDn' bitmap  
object that got created by DefineBitmap? I'd like to be able to  
manipulate both the -background value and the -data value.

This question is also online at: http://www.perlmonks.org/?node_id=849564

Thanks
-Craig

use strict;
use warnings;

use Tk;

my $top = MainWindow->new();

my $arrowDnBits = pack("b8" x 5,
	"........",
	".111111.",
	"..1111..",
	"...11...",
	"........"
);

$top->DefineBitmap('arrowDn' => 8, 5, $arrowDnBits);

$top->Button(-bitmap=>'arrowDn')->pack();

MainLoop();
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.830 / Virus Database: 271.1.1/3008 - Release Date: 07/15/10
12:35:00

--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk