Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

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

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


gandalf at designaproduct

Sep 13, 2007, 4:29 AM

Post #1 of 3 (54 views)
Permalink
wx.ToplevelWindow.SetIcon: Native MS Windows error dialog pops up in wxPython app, no exception raised, no stack trace

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#wxtoplevelwindowseticon)
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

--
http://mail.python.org/mailman/listinfo/python-list


kyosohma at gmail

Sep 13, 2007, 6:19 AM

Post #2 of 3 (50 views)
Permalink
Re: wx.ToplevelWindow.SetIcon: Native MS Windows error dialog pops up in wxPython app, no exception raised, no stack trace [In reply to]

On Sep 13, 6:29 am, Laszlo Nagy <gand...@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

--
http://mail.python.org/mailman/listinfo/python-list


kyosohma at gmail

Sep 13, 2007, 7:08 AM

Post #3 of 3 (48 views)
Permalink
Re: wx.ToplevelWindow.SetIcon: Native MS Windows error dialog pops up in wxPython app, no exception raised, no stack trace [In reply to]

On Sep 13, 8:41 am, Laszlo Nagy <gand...@shopzeus.com> wrote:
> > 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

I'm told the mailing list is now up. Sorry I wasn't more helpful.

Mike

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.