Using a jpg for a frame icon

Hi,

I can't seem to figure out the new api for py2img's generated python files. I took a jpg file I have that I wanted to use and did this:

python img2py -i mypic.jpg icon.py

This creates a file like this:

<code>
from wx.lib.embeddedimage import PyEmbeddedImage

logo = PyEmbeddedImage(
    "iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAIAAAABlV4SAAAAA3NCSVQICAjb4U/gAAAWkklE"
    "QVRogb16WYxk13ne9//n3K1ubV29zXTPRs4MRZq0SI1FmVJIKpCdADEM6CEPebDlB1oCgphk"
    "BArI9hpECRzbQOhEjmzHQ
    ..................
    <shortened for brevity>
getlogoData = logo.GetData
getlogoImage = logo.GetImage
getlogoBitmap = logo.GetBitmap
getlogoIcon = logo.GetIcon

</code>

Anyway, when I try to set my frame's icon using this, nothing happens and it just gets that lame empty icon symbol instead. Here's what I do:

ico = icon.getlogoIcon()
self.frame.SetIcon(ico)

This worked great before the img2py utility was changed. I'm sure I'm doing something stupid, but I'm completely missing it.

As usual, I'm using wxPython 2.8.9.1, Python 2.5.2 on Windows XP.

Thanks,

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Mike Driscoll wrote:

Anyway, when I try to set my frame's icon using this, nothing happens and it just gets that lame empty icon symbol instead. Here's what I do:

ico = icon.getlogoIcon()
self.frame.SetIcon(ico)

This worked great before the img2py utility was changed. I'm sure I'm doing something stupid, but I'm completely missing it.

As usual, I'm using wxPython 2.8.9.1, Python 2.5.2 on Windows XP.

What size image are you using? Does ico.Ok() return True?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Mike Driscoll wrote:

Anyway, when I try to set my frame's icon using this, nothing happens and it just gets that lame empty icon symbol instead. Here's what I do:

ico = icon.getlogoIcon()
self.frame.SetIcon(ico)

This worked great before the img2py utility was changed. I'm sure I'm doing something stupid, but I'm completely missing it.

As usual, I'm using wxPython 2.8.9.1, Python 2.5.2 on Windows XP.

What size image are you using? Does ico.Ok() return True?

I don't seem to have any decent software on my PC that can tell me what the size is, but it looks like 128x128 or so to me. The ico.Ok() call is returning False and depending on how I run the app, I will either get no error or I get a Pythonw error dialog which says "Failed to load icon from the file "logo.ico" (error 0: the operation completed successfully)". I think this error message is contradictory, but I'm pretty sure it's not from wx.

I'll just try some other icons and see how that goes.

Mike