I'm using wxWindows 2.3.1 and python 2.1.2 on Windows2000. The
offending code is (locatedb.txt is just a non-jpeg file that I happen to
have on my HD):
i = wxImage("c:\\locatedb.txt", wxBITMAP_TYPE_JPEG)
The dialog won't appear if there are no windows displayed. If I just
type the above from an interactive session (after doing
wxInitAllImageHandlers()), this error appears on stdout instead:
Not a JPEG file: starts with 0x63 0x3a
11:44:56: Error: JPEG: Couldn't load - file is probably corrupted.
I'm attaching a program that reproduces the problem:
=====================================================================
from wxPython.wx import *
class BadJpg(wxDialog):
def __init__(self, parent):
wxDialog.__init__(self, parent, -1, "BadJpg")
# create controls
self.okButton = wxButton(self, 1, "O&k")
EVT_BUTTON(self, 1, self.OnOk)
def OnOk(self, event):
try:
i = wxImage("c:\\locatedb.txt", wxBITMAP_TYPE_JPEG)
except:
pass
wxInitAllImageHandlers()
app = wxPySimpleApp()
dlg = BadJpg(None)
dlg.ShowModal()
=====================================================================
--
Mark Wright
mwr...@pro-ns.net
Have you tried using wxLog? try setting your log target to wxLogNull
http://www.wxwindows.org/manuals/2.4.0/wx465.htm#wxlogoverview
If that doesn't keep the error message from popping up, then it's
probably a bug. I encountered a similar bug in wxTIFFHandler, basically
the tiff library was popping up the message directly, bypassing
wxwindows altogether. I uploaded a patch for this problem, that you can
probably adapt for libjpeg if this turns out to be the problem.
http://sourceforge.net/tracker/?group_id=9863&atid=309863&func=detail&aid=740071
Cool, looks like it has finally been applied.
Like I say, though, you probably want to just try changing your log
target first.
-Mark