[PREV] [NEXT] [PREV Thread] [NEXT Thread] [Index]


a904209@pluto.tiuk.ti.com
Re: Help trying to display bitmap on a button ??

Re: Help trying to display bitmap on a button ??

10 May 1996 08:53:48 GMT Texas Instruments Ltd.
Newsgroups:
comp.lang.perl.tk
References:
<31908A89.542B@rome.itd.sterling.com>

     Tim Metzger  wrote in article <31908A89.542B@rome.itd.sterling.com> :
>
>I was under the impression, after reading the limited 
>documentation that I have, that to display a bitmap on
>a button all I would need to do is use the -bitmap
>instead of -text and supply the bitmap name.  Well this
>doesn't work and I get the message
>
> not defined at /usr/local/lib/perl5/Tk/Widget.pm
>
>What's the trick to getting a bitmap to display on a button ??
>Do I need to include some specific file ?

Core Tk needs an '@' on the front of the bitmap path name, and perl needs @
to be escaped.

Here is an example:

#!/usr/local/bin/perl -w
use Tk;
my $mw = MainWindow->new;
my $path   = Tk->findINC("Tk.xbm");
print "path is $path\n";
my $button = $mw->Button(-bitmap => "\@$path");
$button->pack;
MainLoop;

__END__



[PREV] [NEXT] [PREV Thread] [NEXT Thread] [Index]