wx.ToplevelWindow.SetIcon: Native MS Windows error dialog pops up in wxPython app, no exception raised, no stack trace

Laszlo Nagy gandalf at shopzeus.com
Thu Sep 13 09:41:30 EDT 2007


> See main.py of the Demo, line 1129. img2py is in the following default
> location:
> C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wxPython\tools
>   

> Without seeing how you create the image, it's hard to troubleshoot,
> but I would guess that you have an absolute path that you're using in
> your script that is different than what the exe is looking for.
>   
I actually do have a wx.Icon instance loaded from a file. This problem 
is not about loading a file into a wx.Icon instance. This why I'm 
suprised about the message ("cannot load image file"). I already have 
both the icon and the top level window in memory. If I comment out the

self.SetIcon(icon)

line in my code then there is no error message (and no icon on the 
frame). The SetIcon method will call the Windows API at the end, and it 
has nothing to do with files. It accepts a window handle and a pointer 
to an icon resource. I cannot think about anything that would need to 
read from a file while setting the icon of the frame.  Moreover, the 
icon is showing on the frame, looks like there is no error, so why am I 
getting a message? It is not a python Exception, it pops out from 
nowhere. :-) I suspect it will be an internal error in wxWidgets or 
wxPython. But their mailing list is not working. :-(

Thanks anyway.

   Laszlo




More information about the Python-list mailing list