Is there a way to change this, per program?
TIA!
--
Chris Anderson
CTO
C&P Enterprises
http://www.candp-ent.com/
Use the $toplevel->iconbitmap or iconimage method (see perldoc Tk::Wm).
I don't know if this works on all operating systems and window managers,
but at least it works on all that I use.
use Tk;
my $mw = tkinit;
my $image = 'foo.gif'; # 32x32 GIF or BMP
my $icon = $mw->Photo(-file => $image);
$mw->idletasks; # this line is crucial
$mw->iconimage($icon);
MainLoop;
--
Marc Dashevsky -- Remove '_' from address if replying by e-mail.
It works fine under Windows 2000. I test everything before
I post. Did you actually run what I posted? Tell us what
happens on your system.
"Marc Dashevsky" <m_...@world.std.com> wrote in message
news:MPG.16cc6ead1...@netnews.attbi.com...
"Chris" <qab...@prodigy.net> wrote in message
news:nIx88.22194$D_7.340...@newssvr16.news.prodigy.com...
But it WILL do a GIF file.
Using Perl2EXE is there anyway to embed THAT gif into the exe so I am
distributing only 1 file???
:)
TIA!
"Steve Roscio" <steve....@compaq.c-o-m> wrote in message
news:jKx88.645$am1....@news.cpqcorp.net...
I've done the following with bitmaps. I'm almost certain you can
do something similar with GIFs.
my $triangle = "#define triangle_width 11
#define triangle_height 16
static char triangle_bits[] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xfe, 0x03, 0xfc, 0x01,
0xf8, 0x00, 0x70, 0x00,
0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
";
my $arrow = $Top->Bitmap(-data => $triangle);
Just blew me right out of the water! :)
Care to put that one in English? ;P
I have a 32X32X256 GIF that I am using for the image file... :)
Thanks...
Chris
"Marc Dashevsky" <m_...@world.std.com> wrote in message
news:MPG.16cc8849d...@netnews.attbi.com...
> my $triangle = "#define triangle_width 11
> #define triangle_height 16
> static char triangle_bits[] = {
> 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00,
> 0xfe, 0x03, 0xfc, 0x01,
> 0xf8, 0x00, 0x70, 0x00,
> 0x20, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00
> };
> ";
> my $arrow = $Top->Bitmap(-data => $triangle);
Mastering Perl/Tk (p. 427) shows that if you use a binary image format
like GIF, and you want to embed it in your code like the above bitmap,
you have to base64 encode the data into a string. You can then reference
the string with -data.
--Wade
FYI, it does not work with fvwm2. Instead you have to add a line in
your .fvwm2rc config file.
Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
tkrevdiff - graphical display of diffs between revisions (RCS or CVS)
http://ptktools.sourceforge.net/#tkrevdiff
> In article <P6y88.22396$_u.3410...@newssvr16.news.prodigy.com>,
> qab...@prodigy.net says...
> > OK! It doesn't like ICO files! :)
> >
> > But it WILL do a GIF file.
> >
> > Using Perl2EXE is there anyway to embed THAT gif into the exe so I am
> > distributing only 1 file???
>
> I've done the following with bitmaps. I'm almost certain you can
> do something similar with GIFs.
Yes, it works. For gif, the -data string have to be base64 encoded.
Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
babybike - routeplanner for cyclists in Berlin
handheld (e.g. Compaq iPAQ with Linux) version of bbbike
http://bbbike.sourceforge.net
> Does the pic HAVE to be either a BMP or JPG???
> I get an error that it can't find the ICO file...
It should be a photo format supported by Tk, that is GIF, PPM, XPM,
BMP (and with additional modules PNG, JPEG, TIFF). ICO is not
supported.
Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
tkrevdiff - graphical display of diffs between revisions (RCS or CVS)
http://ptktools.sourceforge.net/#tkrevdiff
> In article <Pzz88.22450$6l2.341...@newssvr16.news.prodigy.com>,
> qab...@prodigy.net says...
> > WHOA!
> >
> > Just blew me right out of the water! :)
> >
> > Care to put that one in English? ;P
>
> Let me direct you to Wade's reply. As he suggests, I'm looking
> at page 427 in Lidie & Walsh's MASTERING PERL/TK. It shows how
> to use MIME::Base64 to encode your 32x32x256 GIF file. You then
> would use something like the following code:
>
> use Tk;
> my $mw = tkinit;
> my $imagedata = A STRING CONTAINING A BASE64 ENCODING OF THE GIF
> my $icon = $mw->Photo(-data => $imagedata, -format => 'gif');
> $mw->idletasks; # this line is crucial
> $mw->iconimage($icon);
> MainLoop;
>
> To be honest, I couldn't get a GIF to work, either from a data string
> or from a file. I get an all-black icon. If this is what Tom Baker
> was referring to, I would love to see how to do this with the Icon
> method.
Maybe a Perl/Tk together with Windows problem? It works with Unix (KDE2).
Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
> It should be a photo format supported by Tk, that is GIF, PPM, XPM,
> BMP (and with additional modules PNG, JPEG, TIFF). ICO is not
> supported.
It can also be a Unix X11 bitmap (class Bitmap, extension=xbm), or a
Pixmap (Class Pixmap, extension=xpm).
You can create a Photo of a .xbm file (rather than a Bitmap), or a Photo
of a .xpm file (rather than a Pixmap), but a Photo of a bitmap/pixmap
file uses more resources than an object of class Bitmap/Pixmap.
> In article <3C629E24...@ntlworld.com>, tom.b...@ntlworld.com says...
> > This only works on Unix compatible OS. NOT Win32!!
>
> It works fine under Windows 2000. I test everything before
> I post. Did you actually run what I posted? Tell us what
> happens on your system.
I'm not the OP, but it works fine on Win98.
--
Kevin Michael Vail | a billion stars go spinning through the night,
ke...@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . . | will be, when all the stars are dead. (Rainer Maria Rilke)
I tried to run exactly what you posted (under win2000) and the icon is
not being displayed correctly; it just shows a white icon for a bitmap
and a black one when using a gif format. I checked that I have
Tk::Photo - any suggestions?
...
$data{error} = <<EOF;
R0lGODlhIgAiAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAiACIA
AAP/CLrc/jACFLqKoMvtikJRdDUCA0GXmzFQdJkDQZcbMAJFl1swAkGXN1B0uRsDQZchUHS5
XVAg6HKg6HK7oBgEXQ0UXdpdgQhFNwZBN1B0iQhFV4mQUHQDQTdQVJFUUXSRVFFUYxBUA0UX
SVVEUJBUUXRjBkEDRVeRVEVWkehqDIIGiu4i6TKK7sYgaKDoMpKuouhyDA5AoOiyIOmi6LIE
zgAEii4Lki6KLkvgDECg6DKSrqLocgwOQKDoLpIuo+huDA5AoOgqkqrIKhJdjcEBgEDRRVIV
ERQkVRTdmMEBgEBRRVJF0UVSRVGNGRwACBRdIkLRVSIkFN2YQVANFF3aYV2BCEU3ZnAQdANF
l9sFxcwMgm6g6HK7oJgZBF0NFF3uxpgZBF2OQNHlFoyYmUHQZRgMFF3mwFFF0OUdDEXR1QgM
HFUEXW7AGQxdxdFF0OVmHF1mBF1uVzS6iqDL7Q8jQAkAOw==
EOF
$image{error} = $mw->Photo(-data=>$data{error}, -format=>"gif");
...
# then, for example,...
my $dialog = $mw->Dialog(
-title => $PROGRAM,
-image => $image{error},
-text => $text,
-font => "Arial 8",
-buttons => [@buttons],
-default_button => $buttons[0],
);
Cary Millsap
=====encode.pl=====
use strict;
use warnings;
use Tk;
use Tk::Photo;
my $file = $ARGV[0];
my $w = MainWindow->new;
my $photo = $w->Photo(-file=>$file, -format=>"gif");
print $photo->data(-format=>"gif");
"Chris" <qab...@prodigy.net> wrote in message
news:P6y88.22396$_u.341...@newssvr16.news.prodigy.com...