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

kyosohma at gmail.com kyosohma at gmail.com
Thu Sep 13 15:19:18 CEST 2007


On Sep 13, 6:29 am, Laszlo Nagy <gand... at designaproduct.biz> wrote:
>   Hello,
>
> I wrote a small program that works uses wxPython. The same application
> works on Linux and Windows. When I start it from MS Windows, I see this
> error message appearing each time I open a window:
>
> ---------------------------
> Warehouseclient Error
> ---------------------------
> Can't load image from file '': file does not exist.
> ---------------------------
> OK
> ---------------------------
>
> The message box itself is a native MS Windows dialog. Otherwise the
> program works fine, just here is this annoying message. There is no
> exception raised in the Python program. Nothing printed on console. I
> figured out that this happens only when I set the icon of the window
> using this code:
>
> self.SetIcon(icon)
>
> However, the error dialog is not displayed right after the SetIcon call
> and no exception is raised. The dialog is displayed after __init__ has
> been called, and probably before EVT_SHOW gets called. Documentation of
> SetIcon
> (http://wxwidgets.org/manuals/stable/wx_wxtoplevelwindow.html#wxtoplev...)
> says that it is safe to delete the icon after calling this function. Now
> here are the wreid things:
>
> 1. The icon is displayed correctly in the left top corner, so where is
> the error?
> 2. The error message complains about a file. What has
> wx.ToplevelFrame.SetIcon do with files?
>
> I'm using: Windows XP Professional, Python 2.5, wxPython 2.8
>
> Thanks,
>
>    Laszlo

Normally I would recommend posting to the wxPython list, but it's down
at the moment. Keep an eye on their website as I'm sure they'll let
the community know when it's back up.

In the meantime, I'd look at how the demo does the icon displaying. It
looks like they created the icon they use using the img2py script
which basically creates a python file representation of the image.

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.

Mike




More information about the Python-list mailing list