I developed an application in wxPython (using wxPython 2.6.3.2 and
Python 2.3) which plots some png graphs and displays them in a
wx.html.HtmlWindow. When I run the program, I get an error message
saying that no handlers were found for the img type, and the images are
not displayed. I am able to view the images in a html browser.
I have tried adding wx.InitAllImageHandlers() before calling the
Mainloop (I use wx.PySimpleApp), but I still get the error. I also
tried addimg the line: wx.Image.AddHandler(wx.PNGHandler) but I get a
TypeError. These are the suggestions that I have come across so far on
the net.
The application runs fine on Linux; I only get this error when I run it
on windows.
Any help is really appreciated.
Thanks
Nneoma.
NB: This is my first attempt at using wxPython, which rocks!
···
--
___________________________________
Nneoma Ogbonna
Bioprocess Engineering Research Unit
Department of Chemical Engineering
University of Cape Town
Rondebosch 7701 South Africa
Tel: 27-21-650 5524 [work]
Fax: 27-21-650 5501
I developed an application in wxPython (using wxPython 2.6.3.2 and
Python 2.3) which plots some png graphs and displays them in a
wx.html.HtmlWindow. When I run the program, I get an error message
saying that no handlers were found for the img type, and the images are
not displayed. I am able to view the images in a html browser.
I have tried adding wx.InitAllImageHandlers() before calling the
Mainloop (I use wx.PySimpleApp),
This isn't necessary any more as wxInitAllImageHandlers is called by the module startup code when wxPython is first imported.
but I still get the error. I also
tried addimg the line: wx.Image.AddHandler(wx.PNGHandler) but I get a
TypeError.
This should not be needed either, but if it was the syntax would be:
wx.Image.AddHandler(wx.PNGHandler())
These are the suggestions that I have come across so far on
the net.
The application runs fine on Linux; I only get this error when I run it
on windows.
How is the image referred to in the html? Are you sure the image file is valid? Can you load it directly with wx.Image?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
This should not be needed either, but if it was the syntax would be:
wx.Image.AddHandler(wx.PNGHandler())
I added this line to the app, but I still get the error.
How is the image referred to in the html?
The images are stored in the same folder as the html file. Just the name of the images are given in the html file, for instance,
<img src="bulkacid.png"> .
Are you sure the image file
is valid? Can you load it directly with wx.Image?
Yes I am sure the image file is valid. Like I said earlier, I can load the images in a html browser such as firefox or IE. I can also load the images using wx.Image. All the images in the html file are displayed when I load the file from the wxPython demo htmlWindow .
The weird thing is that in the app I developed, some of the images are displayed in the wx.html.HtmlWindow, while others are not. Also, the app runs fine on some windows machines but not on others.
Thanks
Nneoma
···
--
___________________________________
Nneoma Ogbonna
Bioprocess Engineering Research Unit
Department of Chemical Engineering
University of Cape Town
Rondebosch 7701 South Africa
Tel: 27-21-650 5524 [work]
Fax: 27-21-650 5501
I think I figured out the problem. The app tries to display the graphs while they are still being plotted by gnuplot. Inserting a time.sleep statement gives gnuplot some time to complete the plots before they are loaded by the htnl window. I am currently investigating doing this with threads.
cheers
Nneoma
···
--
___________________________________
Nneoma Ogbonna
Bioprocess Engineering Research Unit
Department of Chemical Engineering
University of Cape Town
Rondebosch 7701 South Africa
Tel: 27-21-650 5524 [work]
Fax: 27-21-650 5501