I've recently discovered the Icon method for Tk's Toplevel windows and have used it to replace the "Tk" logo with an image of my own. However, this method seems not to honor transparent pixels, replacing them instead with opaque black. This is the case whether I use a Tk::Photo image derived from a .gif file, or a Tk::Pixmap image derived from an .xbm file. Is there a way around this apparent limitation? (I'm using ActiveState Perl 5.8 on Windows XP.)

______________________

Update: Thanks to PodMaster for pointing me to the perltk.org site. (I don't know why I never think to look there for Tk stuff. I'm more at home here, I guess.) After plumbing the depths of the forum there, I discovered the answer is that it can't be done with Photo or Pixmap images. However, there's a module, Tk::Icon, that allows one to use Windows .ico files instead. It's not on CPAN or in ActiveState's ppm repository and can be rather hard to locate. So here are the magic words required to get it via ppm:

ppm install http://www.bribes.org/perl/ppm/Tk-Icon.ppd
I tried it, and it works. BTW, you need only create a 32x32 icon. Tk will shrink it to 16x16 for you.

Thanks to Martin Schmucker for providing this useful module and to J. L. Morel of bribes.org for compiling a 5.8-compatible version and posting in his repository!


In reply to Transparency Issues with Tk Toplevel Icons by Dr. Mu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.