For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > October 2007 > Icon method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Icon method
Graham Stow

2007-10-23, 7:10 pm

At the top of page 242 of O'Reillys Ostrich book Matering Perl/Tk (the
Bible), Steve Lidie and Nancy Walsh refer to the Icon method that allows one
to specify an image instead of a bitmap. However, the Icon method itself is
not explained. Can anyone help?


zentara

2007-10-24, 8:03 am

On Tue, 23 Oct 2007 21:47:37 +0100, "Graham Stow" <graham@letsgouk.com>
wrote:

>At the top of page 242 of O'Reillys Ostrich book Matering Perl/Tk (the
>Bible), Steve Lidie and Nancy Walsh refer to the Icon method that allows one
>to specify an image instead of a bitmap. However, the Icon method itself is
>not explained. Can anyone help?
>


Is this what you are looking for?

#!/usr/bin/perl
use Tk;

my $mw = tkinit;

my $image = 'z-icon.gif'; # 32x32 GIF or BMP

my $icon = $mw->Photo(-file => $image);

$mw->idletasks; # this line is crucial

$mw->iconimage($icon);
MainLoop;
__END__

zentara

--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Graham Stow

2007-10-24, 7:08 pm


"zentara" <zentara@highstream.net> wrote in message
news:037uh31bb5tfat76fc8nd0lhki6ukfgdh5@
4ax.com...
> On Tue, 23 Oct 2007 21:47:37 +0100, "Graham Stow" <graham@letsgouk.com>
> wrote:
>
[color=darkred]
> Is this what you are looking for?
> #!/usr/bin/perl
> use Tk;
> my $mw = tkinit;
> my $image = 'z-icon.gif'; # 32x32 GIF or BMP
> my $icon = $mw->Photo(-file => $image);
> $mw->idletasks; # this line is crucial
> $mw->iconimage($icon);
> MainLoop;
> __END__
>
> zentara
>
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html


It certainly is. Works a treat! Thanks Zentara.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com